Files
nixpkgs/pkgs/by-name/co/comma/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

71 lines
1.9 KiB
Nix

{
stdenv,
comma,
fetchFromGitHub,
installShellFiles,
fzy,
lib,
nix-index-unwrapped,
nix,
rustPlatform,
testers,
buildPackages,
}:
rustPlatform.buildRustPackage rec {
pname = "comma";
version = "2.3.3";
src = fetchFromGitHub {
owner = "nix-community";
repo = "comma";
rev = "v${version}";
hash = "sha256-dNek1a8Yt3icWc8ZpVe1NGuG+eSoTDOmAAJbkYmMocU=";
};
cargoHash = "sha256-SJBfWjOVrv2WMIh/cQbaFK8jn3oSbmJpdJM7pkJppDs=";
nativeBuildInputs = [ installShellFiles ];
postPatch = ''
substituteInPlace ./src/main.rs \
--replace-fail '"nix-locate"' '"${lib.getExe' nix-index-unwrapped "nix-locate"}"' \
--replace-fail '"nix"' '"${lib.getExe nix}"' \
--replace-fail '"nix-env"' '"${lib.getExe' nix "nix-env"}"' \
--replace-fail '"fzy"' '"${lib.getExe fzy}"'
'';
postInstall = ''
ln -s $out/bin/comma $out/bin/,
mkdir -p $out/share/comma
cp $src/etc/command-not-found.sh $out/share/comma
cp $src/etc/command-not-found.nu $out/share/comma
cp $src/etc/command-not-found.fish $out/share/comma
patchShebangs $out/share/comma/command-not-found.sh
substituteInPlace \
"$out/share/comma/command-not-found.sh" \
"$out/share/comma/command-not-found.nu" \
"$out/share/comma/command-not-found.fish" \
--replace-fail "comma --ask" "$out/bin/comma --ask"
''
+ lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
${stdenv.hostPlatform.emulator buildPackages} "$out/bin/comma" --mangen > comma.1
installManPage comma.1
'';
passthru.tests = {
version = testers.testVersion { package = comma; };
};
meta = with lib; {
homepage = "https://github.com/nix-community/comma";
description = "Runs programs without installing them";
license = licenses.mit;
mainProgram = "comma";
maintainers = with maintainers; [ artturin ];
};
}