gh-f: cleanup

- Use `propagatedUserEnvPkgs`
- Add `nix-update-script`
- `finalAttrs` pattern
This commit is contained in:
Yiyu Zhou 2025-08-15 01:27:10 -07:00
parent 6fa44511c7
commit 6caf19dc2f

View File

@ -2,7 +2,7 @@
lib,
fetchFromGitHub,
stdenvNoCC,
makeWrapper,
makeBinaryWrapper,
gh,
fzf,
coreutils,
@ -10,48 +10,55 @@
gnused,
withBat ? false,
bat,
nix-update-script,
}:
let
binPath = lib.makeBinPath (
[
gh
fzf
coreutils
gawk
gnused
]
++ lib.optional withBat bat
);
in
stdenvNoCC.mkDerivation rec {
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "gh-f";
version = "1.4.1";
src = fetchFromGitHub {
owner = "gennaro-tedesco";
repo = "gh-f";
rev = "v${version}";
tag = "v${finalAttrs.version}";
hash = "sha256-Jf7sDn/iRB/Lwz21fGLRduvt9/9cs5FFMhazULgj1ik=";
};
nativeBuildInputs = [
makeWrapper
];
nativeBuildInputs = [ makeBinaryWrapper ];
propagatedUserEnvPkgs = [
gh
fzf
coreutils
gawk
gnused
]
++ lib.optional withBat bat;
installPhase = ''
runHook preInstall
install -D -m755 "gh-f" "$out/bin/gh-f"
runHook postInstall
'';
postFixup = ''
wrapProgram "$out/bin/gh-f" --prefix PATH : "${binPath}"
wrapProgram "$out/bin/gh-f" \
--suffix PATH : ${lib.makeBinPath finalAttrs.propagatedUserEnvPkgs}
'';
meta = with lib; {
passthru.updateScript = nix-update-script { };
meta = {
homepage = "https://github.com/gennaro-tedesco/gh-f";
description = "GitHub CLI ultimate FZF extension";
maintainers = with maintainers; [ loicreynier ];
license = licenses.unlicense;
license = lib.licenses.unlicense;
mainProgram = "gh-f";
platforms = platforms.all;
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [
loicreynier
yiyu
];
};
}
})