]>
Commit | Line | Data |
---|---|---|
1 | { pkgs ? import <nixpkgs> { }, lint ? false }: | |
2 | ||
3 | let | |
4 | checkInputsAreNative = pkgs.lib.hasInfix "nativeCheckInputs" | |
5 | (builtins.readFile <nixpkgs/doc/stdenv/stdenv.chapter.md>); | |
6 | checkInputsName = | |
7 | if checkInputsAreNative then "nativeCheckInputs" else "checkInputs"; | |
8 | ||
9 | git-cache-fallback = { buildPythonPackage, fetchgit, git, backoff, mypy, }: | |
10 | buildPythonPackage rec { | |
11 | pname = "git-cache"; | |
12 | version = "1.5.0"; | |
13 | src = fetchgit { | |
14 | url = "https://git.scottworley.com/pub/git/git-cache"; | |
15 | rev = "v${version}"; | |
16 | hash = "sha256-g4TS/zX3e29Q3ThsCAX2wLLlYbi8fdux5uqAc+b/Oww="; | |
17 | }; | |
18 | propagatedBuildInputs = [ backoff ]; | |
19 | "${checkInputsName}" = [ git mypy ]; | |
20 | doCheck = true; | |
21 | checkPhase = "./test.sh"; | |
22 | }; | |
23 | ||
24 | in pkgs.python3Packages.callPackage ({ lib, buildPythonPackage, nix_2_3, git | |
25 | , autopep8, makeWrapper, mypy, pylint, git-cache, }: | |
26 | buildPythonPackage rec { | |
27 | pname = "pinch"; | |
28 | version = "3.1.0"; | |
29 | src = lib.cleanSource ./.; | |
30 | buildInputs = [ makeWrapper ]; | |
31 | propagatedBuildInputs = [ git-cache ]; | |
32 | "${checkInputsName}" = [ nix_2_3 git mypy ] | |
33 | ++ lib.optionals lint [ autopep8 pylint ]; | |
34 | postInstall = '' | |
35 | wrapProgram "$out/bin/pinch" --prefix PATH : ${nix_2_3}/bin | |
36 | ''; | |
37 | doCheck = true; | |
38 | checkPhase = "./test.sh"; | |
39 | meta = { | |
40 | description = "A replacement for `nix-channel --update`"; | |
41 | homepage = "https://git.scottworley.com/pinch"; | |
42 | license = pkgs.lib.licenses.gpl3; | |
43 | maintainers = with pkgs.lib.maintainers; [ chkno ]; | |
44 | }; | |
45 | }) { | |
46 | git-cache = | |
47 | pkgs.python3Packages.git-cache or (pkgs.python3Packages.callPackage | |
48 | git-cache-fallback { }); | |
49 | nix_2_3 = pkgs.nix_2_3 or pkgs.nix; | |
50 | } |