forked from viperML/nh
-
Notifications
You must be signed in to change notification settings - Fork 4
/
package.nix
67 lines (58 loc) · 1.55 KB
/
package.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
{
stdenv,
lib,
rustPlatform,
installShellFiles,
makeBinaryWrapper,
darwin,
nvd,
use-nom ? true,
nix-output-monitor ? null,
rev ? "dirty",
}:
assert use-nom -> nix-output-monitor != null;
let
runtimeDeps = [ nvd ] ++ lib.optionals use-nom [ nix-output-monitor ];
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in
rustPlatform.buildRustPackage {
pname = "nh_plus";
version = "${cargoToml.package.version}-${rev}";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ./.)) (
lib.fileset.unions [
./src
./Cargo.toml
./Cargo.lock
]
);
};
strictDeps = true;
nativeBuildInputs = [
installShellFiles
makeBinaryWrapper
];
buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ];
doCheck = false; # faster builds
preFixup = ''
installShellCompletion --cmd nh \
--bash <("$out/bin/nh" completions --shell bash) \
--zsh <("$out/bin/nh" completions --shell zsh) \
--fish <("$out/bin/nh" completions --shell fish)
'';
postFixup = ''
wrapProgram $out/bin/nh \
--prefix PATH : ${lib.makeBinPath runtimeDeps}
'';
cargoLock.lockFile = ./Cargo.lock;
meta = {
description = "Fork of nh with added support for nix-darwin and other features.";
homepage = "https://github.com/ToyVo/nh_plus";
license = lib.licenses.eupl12;
mainProgram = "nh";
maintainers = with lib.maintainers; [
ToyVo
];
};
}