]> git.scottworley.com Git - pinch/blame - default.nix
Don't leave old channels laying around
[pinch] / default.nix
CommitLineData
420bd8c9 1{ pkgs ? import <nixpkgs> { }, lint ? false }:
d06918bc
SW
2
3let
f9bfb2d0
SW
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, }:
d06918bc
SW
23 buildPythonPackage rec {
24 pname = "git-cache";
9eecb073 25 version = "1.4.1";
d06918bc
SW
26 src = fetchgit {
27 url = "https://scottworley.com/git-cache.git";
28 rev = "v${version}";
9eecb073 29 sha256 = "0ml1myhmd9mw1z5bwni9fhvx7h9dknhmqq4nyci9n5lvrhbmcdc9";
d06918bc 30 };
f9bfb2d0 31 propagatedBuildInputs = [ backoff ];
d06918bc
SW
32 checkInputs = [ git mypy ];
33 doCheck = true;
34 checkPhase = "./test.sh";
35 };
36
5144c1d3 37in pkgs.python3Packages.callPackage ({ lib, buildPythonPackage, nix_2_3, git
f2f22eb2 38 , autopep8, makeWrapper, mypy, pylint, git-cache, }:
b5964ec3
SW
39 buildPythonPackage rec {
40 pname = "pinch";
b11f21b0 41 version = "3.0.7-pre";
b5964ec3 42 src = lib.cleanSource ./.;
f2f22eb2 43 buildInputs = [ makeWrapper ];
d06918bc 44 propagatedBuildInputs = [ git-cache ];
5144c1d3 45 checkInputs = [ nix_2_3 git mypy ] ++ lib.optionals lint [ autopep8 pylint ];
f2f22eb2 46 postInstall = ''
5144c1d3 47 wrapProgram "$out/bin/pinch" --prefix PATH : ${nix_2_3}/bin
f2f22eb2 48 '';
b5964ec3
SW
49 doCheck = true;
50 checkPhase = "./test.sh";
d06918bc
SW
51 }) {
52 git-cache =
53 pkgs.python3Packages.git-cache or (pkgs.python3Packages.callPackage
f9bfb2d0
SW
54 git-cache-fallback {
55 backoff =
56 pkgs.python3Packages.backoff or (pkgs.python3Packages.callPackage
57 backoff-fallback { });
58 });
5144c1d3 59 nix_2_3 = pkgs.nix_2_3 or pkgs.nix;
d06918bc 60 }