-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
68 lines (61 loc) · 1.96 KB
/
Copy pathflake.nix
File metadata and controls
68 lines (61 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
description = "git-fzf — interactive fuzzy finder for Git";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
runtimeDeps = with pkgs; [ fzf gum fd ];
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "git-fzf";
version = pkgs.lib.removeSuffix "\n" (builtins.readFile ./version.txt);
src = ./.;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/share/git-fzf/scripts $out/bin
cp git-fzf version.txt $out/share/git-fzf/
cp scripts/*.sh scripts/*.awk $out/share/git-fzf/scripts/
chmod +x $out/share/git-fzf/git-fzf $out/share/git-fzf/scripts/*.sh
makeWrapper $out/share/git-fzf/git-fzf $out/bin/git-fzf \
--prefix PATH : ${pkgs.lib.makeBinPath runtimeDeps}
'';
meta = with pkgs.lib; {
description = "Interactive fuzzy finder for Git";
homepage = "https://github.com/git-extensions/git-fzf";
license = licenses.mit;
maintainers = [ ];
mainProgram = "git-fzf";
platforms = platforms.unix;
};
};
devShells.default = pkgs.mkShell {
name = "git-fzf";
packages = with pkgs; [
bash
git
fzf
gum
fd
bats
shellcheck
];
shellHook = ''
if ! fzf --version | awk -F'[. ]' '$1>0 || ($1==0 && $2>=54) {found=1} END {exit !found}' 2>/dev/null; then
echo "warning: fzf 0.54+ recommended — some keybindings may not work with older versions"
fi
'';
};
}
);
}