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