-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathdefault.nix
72 lines (64 loc) · 1.91 KB
/
default.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
68
69
70
71
72
{
pkgs ? import <nixpkgs> { },
withSandboxSupport ? false,
withAutocomplete ? true,
withNom ? false,
}:
with pkgs;
let
withNom' =
withNom
&& (builtins.tryEval (builtins.elem buildPlatform.system pkgs.ghc.meta.platforms)).value or false;
in
python3Packages.buildPythonApplication {
name = "nixpkgs-review";
src = ./.;
format = "pyproject";
nativeBuildInputs = [
installShellFiles
] ++ lib.optional withAutocomplete python3Packages.argcomplete;
dependencies = with python3Packages; [ argcomplete ];
nativeCheckInputs =
[
python3Packages.setuptools
python3Packages.pylint
# needed for interactive unittests
python3Packages.pytest
python3Packages.pytest-xdist
pkgs.nixVersions.stable or nix_2_4
git
]
++ lib.optional withSandboxSupport bubblewrap
++ lib.optional withNom' nix-output-monitor;
checkPhase = ''
echo -e "\x1b[32m## run nixpkgs-review --help\x1b[0m"
NIX_STATE_DIR=$TMPDIR/var/nix $out/bin/nixpkgs-review --help
'';
makeWrapperArgs =
let
binPath =
[
pkgs.nixVersions.stable or nix_2_4
git
]
++ lib.optional withSandboxSupport bubblewrap
++ lib.optional withNom' nix-output-monitor;
in
[
"--prefix PATH : ${lib.makeBinPath binPath}"
"--set-default NIX_SSL_CERT_FILE ${cacert}/etc/ssl/certs/ca-bundle.crt"
# we don't have any runtime deps but nix-review shells might inject unwanted dependencies
"--unset PYTHONPATH"
];
postInstall = lib.optionalString withAutocomplete ''
for cmd in nix-review nixpkgs-review; do
installShellCompletion --cmd $cmd \
--bash <(register-python-argcomplete $cmd) \
--fish <(register-python-argcomplete $cmd -s fish) \
--zsh <(register-python-argcomplete $cmd -s zsh)
done
'';
shellHook = ''
# workaround because `python setup.py develop` breaks for me
'';
}