File tree Expand file tree Collapse file tree 2 files changed +52
-3
lines changed
pkgs/development/python-modules/homf Expand file tree Collapse file tree 2 files changed +52
-3
lines changed Original file line number Diff line number Diff line change 11{
22 lib ,
33 buildPythonPackage ,
4+ callPackage ,
45 fetchFromGitHub ,
56 # pytestCheckHook,
67 pythonOlder ,
8+ versionCheckHook ,
79
810 hatchling ,
911 packaging ,
1012} :
1113
1214buildPythonPackage rec {
1315 pname = "homf" ;
14- version = "1.0.0 " ;
16+ version = "1.1.1 " ;
1517 pyproject = true ;
1618 disabled = pythonOlder "3.8" ;
1719
1820 src = fetchFromGitHub {
1921 owner = "duckinator" ;
2022 repo = "homf" ;
2123 rev = "refs/tags/v${ version } " ;
22- hash = "sha256-PU5VjBIVSMupTBh/qvVuZSFWpBbJOylCR02lONn9/qw =" ;
24+ hash = "sha256-fDH6uJ2d/Jsnuudv+Qlv1tr3slxOJWh7b4smGS32n9A =" ;
2325 } ;
2426
2527 build-system = [ hatchling ] ;
2628
2729 pythonRelaxDeps = [ "packaging" ] ;
28-
2930 dependencies = [ packaging ] ;
3031
3132 pythonImportsCheck = [
@@ -39,6 +40,11 @@ buildPythonPackage rec {
3940 # nativeCheckInputs = [ pytestCheckHook ];
4041 # pytestFlagsArray = [ "-m 'not network'" ];
4142
43+ nativeBuildInputs = [ versionCheckHook ] ;
44+
45+ # (Ab)using `callPackage` as a fix-point operator, so tests can use the `homf` drv
46+ passthru . tests = callPackage ./tests.nix { } ;
47+
4248 meta = with lib ; {
4349 description = "Asset download tool for GitHub Releases, PyPi, etc." ;
4450 mainProgram = "homf" ;
Original file line number Diff line number Diff line change 1+ {
2+ lib ,
3+ runCommand ,
4+ testers ,
5+
6+ cacert ,
7+ homf ,
8+ } :
9+ let
10+ # runs homf, putting the fetched artefacts in the drv output
11+ Homf =
12+ subcommand :
13+ {
14+ pkgName ,
15+ version ,
16+ hash ,
17+ } :
18+ # testers.runCommand ensures we have an FOD, so the command has network access,
19+ # yet the test is rerun whenever one of its inputs changes.
20+ testers . runCommand {
21+ name = "homf-${ subcommand } -${ pkgName } " ;
22+ script = "homf ${ subcommand } --directory $out ${ pkgName } ${ version } " ;
23+ nativeBuildInputs = [
24+ cacert
25+ homf
26+ ] ;
27+ inherit hash ;
28+ } ;
29+ in
30+
31+ lib . mapAttrs Homf {
32+ pypi = {
33+ pkgName = "homf" ;
34+ version = "1.1.1" ; # pinned so updating homf won't invalidate hashes
35+ hash = "sha256-zpdt7+zTaGkLG6xYoTZVw/kUek0/MrCqvljfLxNB94A=" ;
36+ } ;
37+
38+ github = {
39+ pkgName = "duckinator/homf" ;
40+ version = "v1.1.1" ;
41+ hash = "sha256-NeEz8wZqDWYUnrgsknXWHzhWdk8cPW8mknKS3+/dngQ=" ;
42+ } ;
43+ }
You can’t perform that action at this time.
0 commit comments