base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ni / nixpkgs-review / package.nix
blobe7aebeff6093dff53ac2c1da5b06ac38aac77727
2   lib,
3   python3Packages,
4   fetchFromGitHub,
6   installShellFiles,
7   bubblewrap,
8   nix-output-monitor,
9   cacert,
10   git,
11   nix,
12   versionCheckHook,
14   withAutocomplete ? true,
15   withSandboxSupport ? false,
16   withNom ? false,
19 python3Packages.buildPythonApplication rec {
20   pname = "nixpkgs-review";
21   version = "2.12.0";
22   pyproject = true;
24   src = fetchFromGitHub {
25     owner = "Mic92";
26     repo = "nixpkgs-review";
27     rev = "refs/tags/${version}";
28     hash = "sha256-yNdBqL3tceuoUHx8/j2y5ZTq1zeVDAm37RZtlCbC6rg=";
29   };
31   build-system = [
32     python3Packages.setuptools
33   ];
35   dependencies = lib.optionals withAutocomplete [
36     python3Packages.argcomplete
37   ];
39   nativeBuildInputs =
40     [
41       installShellFiles
42     ]
43     ++ lib.optionals withAutocomplete [
44       python3Packages.argcomplete
45     ];
47   makeWrapperArgs =
48     let
49       binPath = [
50         nix
51         git
52       ] ++ lib.optional withSandboxSupport bubblewrap ++ lib.optional withNom nix-output-monitor;
53     in
54     [
55       "--prefix PATH : ${lib.makeBinPath binPath}"
56       "--set-default NIX_SSL_CERT_FILE ${cacert}/etc/ssl/certs/ca-bundle.crt"
57       # we don't have any runtime deps but nixpkgs-review shells might inject unwanted dependencies
58       "--unset PYTHONPATH"
59     ];
61   postInstall = lib.optionalString withAutocomplete ''
62     for cmd in nix-review nixpkgs-review; do
63       installShellCompletion --cmd $cmd \
64         --bash <(register-python-argcomplete $cmd) \
65         --fish <(register-python-argcomplete $cmd -s fish) \
66         --zsh <(register-python-argcomplete $cmd -s zsh)
67     done
68   '';
70   nativeCheckInputs = [
71     versionCheckHook
72   ];
73   versionCheckProgramArg = [ "--version" ];
75   meta = {
76     changelog = "https://github.com/Mic92/nixpkgs-review/releases/tag/${version}";
77     description = "Review pull-requests on https://github.com/NixOS/nixpkgs";
78     homepage = "https://github.com/Mic92/nixpkgs-review";
79     license = lib.licenses.mit;
80     mainProgram = "nixpkgs-review";
81     maintainers = with lib.maintainers; [
82       figsoda
83       mic92
84     ];
85   };