nixpkgs/pkgs/by-name/xp/xplr/package.nix
Alyssa Ross 63bff8c132
treewide: migrate to fetchCargoVendor, batch 1
Cargo 1.84.0 seems to have changed the output format of cargo vendor
again, once again invalidating fetchCargoTarball FOD hashes.  It's
time to fix this once and for all, switching across the board to
fetchCargoVendor, which is not dependent on cargo vendor's output
format.

It should be possible to reproduce this diff.  To do so, get the list
of files changed by this commit, e.g. with git diff --name-only, then
run the following two commands, each with that list of files as their
standard input:

	xargs sed -i 's/^\(. *\)\(cargoHash\)\b/\1useFetchCargoVendor = true;\n\1cargoHash/'
	cut -d / -f 4 | xargs -n 1 nix-update --version=skip

This will take a long time.  It might be possible to parallelize it
using xargs' -P option.  I haven't tested it.
2025-01-23 11:46:43 +01:00

61 lines
1.5 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=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-D8BYJtf6joAXyqLDdAeP4GGAA9W5dvA16ia4/ZeZWaE=";
# 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
];
};
}