forked from Mic92/nixpkgs-review
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefault.nix
60 lines (53 loc) · 1.8 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
{ 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
python3.pkgs.buildPythonApplication {
name = "nixpkgs-review";
src = ./.;
format = "pyproject";
nativeBuildInputs = [ installShellFiles ] ++ lib.optional withAutocomplete python3.pkgs.argcomplete;
propagatedBuildInputs = [ python3.pkgs.argcomplete ];
nativeCheckInputs = [
python3.pkgs.setuptools
python3.pkgs.pylint
glibcLocales
# needed for interactive unittests
python3.pkgs.pytest
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
'';
}