]> git.scottworley.com Git - pinch/blob - default.nix
e8b71283d38212dd4876afde1a3dce8c6894f50a
[pinch] / default.nix
1 { pkgs ? import <nixpkgs> { }, lint ? false }:
2
3 let
4
5 # Remove after https://github.com/NixOS/nixpkgs/pull/93377 reaches stable
6 backoff-fallback = { lib, buildPythonPackage, fetchFromGitHub, pytestCheckHook
7 , poetry, pytest-asyncio, }:
8 buildPythonPackage rec {
9 pname = "backoff";
10 version = "1.10.0";
11 src = fetchFromGitHub {
12 owner = "litl";
13 repo = pname;
14 rev = "v${version}";
15 sha256 = "1jj0l6pjx747d2yyvnzd3qbm4qr73sq6cc56dhvd8wqfbp5279x0";
16 };
17 format = "pyproject";
18 nativeBuildInputs = [ poetry ];
19 checkInputs = [ pytestCheckHook pytest-asyncio ];
20 };
21
22 git-cache-fallback = { buildPythonPackage, fetchgit, git, backoff, mypy, }:
23 buildPythonPackage rec {
24 pname = "git-cache";
25 version = "1.2.1";
26 src = fetchgit {
27 url = "https://scottworley.com/git-cache.git";
28 rev = "v${version}";
29 sha256 = "16yh75176pnbzf48ak7q8lpfpr6digi130i5drxs6k2y9nf7g1jz";
30 };
31 propagatedBuildInputs = [ backoff ];
32 checkInputs = [ git mypy ];
33 doCheck = true;
34 checkPhase = "./test.sh";
35 };
36
37 in pkgs.python3Packages.callPackage
38 ({ lib, buildPythonPackage, nix, git, autopep8, mypy, pylint, git-cache, }:
39 buildPythonPackage rec {
40 pname = "pinch";
41 version = "3.0.1-pre";
42 src = lib.cleanSource ./.;
43 propagatedBuildInputs = [ git-cache ];
44 checkInputs = [ nix git mypy ] ++ lib.optionals lint [ autopep8 pylint ];
45 doCheck = true;
46 checkPhase = "./test.sh";
47 }) {
48 git-cache =
49 pkgs.python3Packages.git-cache or (pkgs.python3Packages.callPackage
50 git-cache-fallback {
51 backoff =
52 pkgs.python3Packages.backoff or (pkgs.python3Packages.callPackage
53 backoff-fallback { });
54 });
55 }