]> git.scottworley.com Git - pinch/blob - default.nix
25.11: Formatting: nixfmt-classic → nixfmt-rfc-style
[pinch] / default.nix
1 {
2 pkgs ? import <nixpkgs> { },
3 lint ? false,
4 }:
5
6 let
7 checkInputsAreNative = pkgs.lib.hasInfix "nativeCheckInputs" (
8 builtins.readFile <nixpkgs/doc/stdenv/stdenv.chapter.md>
9 );
10 checkInputsName = if checkInputsAreNative then "nativeCheckInputs" else "checkInputs";
11
12 git-cache-fallback =
13 {
14 buildPythonPackage,
15 setuptools,
16 fetchgit,
17 git,
18 backoff,
19 mypy,
20 }:
21 buildPythonPackage rec {
22 pname = "git-cache";
23 version = "1.5.0";
24 src = fetchgit {
25 url = "https://git.scottworley.com/pub/git/git-cache";
26 rev = "v${version}";
27 hash = "sha256-g4TS/zX3e29Q3ThsCAX2wLLlYbi8fdux5uqAc+b/Oww=";
28 };
29 pyproject = true;
30 build-system = [ setuptools ];
31 propagatedBuildInputs = [ backoff ];
32 "${checkInputsName}" = [
33 git
34 mypy
35 ];
36 doCheck = true;
37 checkPhase = "./test.sh";
38 };
39
40 in
41 pkgs.python3Packages.callPackage
42 (
43 {
44 lib,
45 buildPythonPackage,
46 setuptools,
47 nix,
48 git,
49 autopep8,
50 mypy,
51 pylint,
52 git-cache,
53 }:
54 buildPythonPackage rec {
55 pname = "pinch";
56 version = "3.3.2";
57 src = lib.cleanSource ./.;
58 pyproject = true;
59 build-system = [ setuptools ];
60 propagatedBuildInputs = [ git-cache ];
61 "${checkInputsName}" = [
62 nix
63 git
64 mypy
65 ]
66 ++ lib.optionals lint [
67 autopep8
68 pylint
69 ];
70 doCheck = true;
71 checkPhase = "./test.sh";
72 meta = {
73 description = "A replacement for `nix-channel --update`";
74 homepage = "https://git.scottworley.com/pinch";
75 license = pkgs.lib.licenses.gpl3;
76 maintainers = with pkgs.lib.maintainers; [ chkno ];
77 };
78 }
79 )
80 {
81 git-cache =
82 pkgs.python3Packages.git-cache or (pkgs.python3Packages.callPackage git-cache-fallback { });
83 }