-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdefault.nix
More file actions
84 lines (77 loc) · 2.48 KB
/
default.nix
File metadata and controls
84 lines (77 loc) · 2.48 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
{ pkgs ? import <nixpkgs> { }, ... }:
let
buildGo = import ./nix/buildGo { inherit pkgs; };
goDeps = import ./nix/go-deps.nix { inherit pkgs; };
# Runtime closure: the Nix file lorri passes to nix-instantiate as --argstr runTimeClosure.
# Baked into the binary at link time via x_defs.
rtc = pkgs.callPackage ./nix/runtime.nix {};
# Vendored direnv shell hook and export machinery (MIT licence).
direnvVendor = buildGo.package {
name = "direnv_vendor";
path = "github.com/nix-community/lorri/direnv_vendor";
srcs = [
./direnv_vendor/shell.go
./direnv_vendor/shell_bash.go
./direnv_vendor/shell_elvish.go
./direnv_vendor/shell_fish.go
./direnv_vendor/shell_json.go
./direnv_vendor/shell_murex.go
./direnv_vendor/shell_pwsh.go
./direnv_vendor/shell_systemd.go
./direnv_vendor/shell_tcsh.go
./direnv_vendor/shell_vim.go
./direnv_vendor/shell_zsh.go
./direnv_vendor/log.go
];
};
lorriBin = buildGo.program {
name = "lorri";
# Bake the runtime closure store path into the binary at link time.
x_defs."main.runtimeClosure" = "${rtc}";
srcs = [
./main.go
./abspath.go
./paths.go
./communicate.go
./logged-evaluation.nix
./builder.go
./watch.go
./build_loop.go
./lorri_db.go
./daemon.go
./envjson.go
./export.go
];
deps = [
direnvVendor
goDeps.fsnotify
goDeps.golang-x-sys-unix
goDeps.zombiezen-go-sqlite
goDeps.zombiezen-go-sqlite.sqlitex
];
};
in
# Wrap the binary together with shell completion files and the man page.
pkgs.symlinkJoin {
name = "lorri";
paths = [ lorriBin ];
nativeBuildInputs = [ pkgs.scdoc ];
postBuild = ''
scdoc < ${./lorri.scd} > lorri.1
install -Dm644 lorri.1 $out/share/man/man1/lorri.1
install -Dm644 ${./contrib/lorri.bash} \
$out/share/bash-completion/completions/lorri
install -Dm644 ${./contrib/lorri.zsh} \
$out/share/zsh/site-functions/_lorri
install -Dm644 ${./contrib/lorri.fish} \
$out/share/fish/vendor_completions.d/lorri.fish
install -Dm644 ${./contrib/lorri.elv} \
$out/share/elvish/completions/lorri.elv
install -Dm644 ${./contrib/lorri.tcsh} \
$out/share/tcsh-completion/completions/lorri.tcsh
install -Dm644 ${./contrib/lorri.mx} \
$out/share/murex/completions/lorri.mx
install -Dm644 ${./contrib/lorri.ps1} \
$out/share/powershell/completions/lorri.ps1
'';
}