diff --git a/pkgs/by-name/co/comma/package.nix b/pkgs/by-name/co/comma/package.nix index f21a8d33e72f..dd35a1b289ca 100644 --- a/pkgs/by-name/co/comma/package.nix +++ b/pkgs/by-name/co/comma/package.nix @@ -3,37 +3,51 @@ fetchFromGitHub, fzy, lib, - makeBinaryWrapper, nix-index-unwrapped, + nix, rustPlatform, testers, }: rustPlatform.buildRustPackage rec { pname = "comma"; - version = "2.2.0"; + version = "2.3.0"; src = fetchFromGitHub { owner = "nix-community"; repo = "comma"; rev = "v${version}"; - hash = "sha256-mhSX2yx+/xDwCtLVb+aSFFxP2TOJek/ZX/28khvetwE="; + hash = "sha256-JogC9NIS71GyimpqmX2/dhBX1IucK395iWZVVabZxiE="; }; useFetchCargoVendor = true; - cargoHash = "sha256-6BsRgxcUtVuN1gp3VVXkNQzqb9hD5rWWctieJvFdyrQ="; + cargoHash = "sha256-Cd4WaOG+OkCM4Q1K9qVzMYOjSi9U8W82JypqUN20x9w="; - nativeBuildInputs = [ makeBinaryWrapper ]; + 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 = '' - wrapProgram $out/bin/comma \ - --prefix PATH : ${ - lib.makeBinPath [ - fzy - nix-index-unwrapped - ] - } ln -s $out/bin/comma $out/bin/, + + mkdir -p $out/etc/profile.d + mkdir -p $out/etc/nushell + mkdir -p $out/etc/fish/functions + + cp $src/etc/comma-command-not-found.sh $out/etc/profile.d + cp $src/etc/comma-command-not-found.nu $out/etc/nushell + cp $src/etc/comma-command-not-found.fish $out/etc/fish/functions + + patchShebangs $out/etc/profile.d/comma-command-not-found.sh + substituteInPlace \ + "$out/etc/profile.d/comma-command-not-found.sh" \ + "$out/etc/nushell/comma-command-not-found.nu" \ + "$out/etc/fish/functions/comma-command-not-found.fish" \ + --replace-fail "comma --ask" "$out/bin/comma --ask" ''; passthru.tests = {