mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-27 08:04:14 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
49 lines
1.4 KiB
Nix
49 lines
1.4 KiB
Nix
{ lib, stdenv, rustPlatform, fetchFromGitHub }:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "xplr";
|
|
version = "0.21.9";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "sayanarijit";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-0c2QJUEQwKEzzDBDP5XdX7xe1rivazsoZtepB4Dxp/c=";
|
|
};
|
|
|
|
cargoHash = "sha256-RZgdWhVBZozYxbbNslCBLhN6EnogpyVXvht6GbzLnPs=";
|
|
|
|
# fixes `thread 'main' panicked at 'cannot find strip'` on x86_64-darwin
|
|
env = lib.optionalAttrs (stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isDarwin) {
|
|
TARGET_STRIP = "${stdenv.cc.targetPrefix}strip";
|
|
};
|
|
|
|
# error: linker `aarch64-linux-gnu-gcc` not found
|
|
postPatch = ''
|
|
rm .cargo/config
|
|
'';
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/share/applications
|
|
cp assets/desktop/xplr.desktop $out/share/applications
|
|
|
|
mkdir -p $out/share/icons/hicolor/scalable/apps
|
|
cp assets/icon/xplr.svg $out/share/icons/hicolor/scalable/apps
|
|
|
|
for size in 16 32 64 128; do
|
|
icon_dir=$out/share/icons/hicolor/''${size}x$size/apps
|
|
mkdir -p $icon_dir
|
|
cp assets/icon/xplr$size.png $icon_dir/xplr.png
|
|
done
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Hackable, minimal, fast TUI file explorer";
|
|
mainProgram = "xplr";
|
|
homepage = "https://xplr.dev";
|
|
changelog = "https://github.com/sayanarijit/xplr/releases/tag/${src.rev}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ sayanarijit suryasr007 pyrox0 mimame figsoda ];
|
|
};
|
|
}
|