forked from cachix/devenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
57 lines (46 loc) · 1.48 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
{ pkgs, inputs }:
pkgs.rustPlatform.buildRustPackage {
pname = "devenv";
version = "1.0.7";
src = pkgs.lib.sourceByRegex ./. [
"^\.cargo(/.*)?$"
"Cargo\.toml"
"Cargo\.lock"
"devenv(/.*)?"
"devenv-run-tests(/.*)?"
"xtask(/.*)?"
];
cargoBuildFlags = [ "-p devenv -p devenv-run-tests" ];
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = [
pkgs.makeWrapper
pkgs.pkg-config
pkgs.installShellFiles
];
buildInputs = [ pkgs.openssl ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
postInstall = ''
wrapProgram $out/bin/devenv \
--set DEVENV_NIX ${inputs.nix.packages.${pkgs.stdenv.system}.nix} \
--prefix PATH ":" "$out/bin:${inputs.cachix.packages.${pkgs.stdenv.system}.cachix}/bin"
# TODO: problematic for our library...
wrapProgram $out/bin/devenv-run-tests \
--set DEVENV_NIX ${inputs.nix.packages.${pkgs.stdenv.system}.nix} \
--prefix PATH ":" "$out/bin:${inputs.cachix.packages.${pkgs.stdenv.system}.cachix}/bin"
# Generate manpages
cargo xtask generate-manpages --out-dir man
installManPage man/*
# Generate shell completions
compdir=./completions
for shell in bash fish zsh; do
cargo xtask generate-shell-completion $shell --out-dir $compdir
done
installShellCompletion --cmd devenv \
--bash $compdir/devenv.bash \
--fish $compdir/devenv.fish \
--zsh $compdir/_devenv
'';
}