-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
51 lines (45 loc) · 1.33 KB
/
flake.nix
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
{
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in with pkgs;
let
dependencies = [ ripgrep fzf bat ];
in {
devShell.x86_64-linux = mkShell {
buildInputs = dependencies;
};
packages.x86_64-linux.fzf-search =
stdenv.mkDerivation {
name = "fzf-search";
src = self;
buildInputs = [makeWrapper ];
installPhase = "
mkdir -p $out/bin;
install -t $out/bin fzf-search;
install -t $out/bin fzf-file;
install -t $out/bin help.1"; #TODO it doesn't belong there
postFixup =
let
dependency_path = pkgs.lib.makeBinPath dependencies;
in
''
wrapProgram "$out/bin/fzf-search" --prefix PATH : "${dependency_path}"
wrapProgram "$out/bin/fzf-file" --prefix PATH : "${dependency_path}"
'';
};
# nix run <loc>#fzf-search
apps.x86_64-linux.fzf-search = {
type = "app";
program = "${self.packages.x86_64-linux.fzf-search}/bin/fzf-search";
};
# nix run <loc>#fzf-file
apps.x86_64-linux.fzf-file = {
type = "app";
program = "${self.packages.x86_64-linux.fzf-search}/bin/fzf-file";
};
# Default nix run
apps.x86_64-linux.default = self.apps.x86_64-linux.fzf-search;
};
}