about summary refs log tree commit diff
path: root/pkgs/development/python-modules/homf/tests.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/homf/tests.nix')
-rw-r--r--pkgs/development/python-modules/homf/tests.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/homf/tests.nix b/pkgs/development/python-modules/homf/tests.nix
new file mode 100644
index 0000000000000..a883334ce40dc
--- /dev/null
+++ b/pkgs/development/python-modules/homf/tests.nix
@@ -0,0 +1,43 @@
+{
+  lib,
+  runCommand,
+  testers,
+
+  cacert,
+  homf,
+}:
+let
+  # runs homf, putting the fetched artefacts in the drv output
+  Homf =
+    subcommand:
+    {
+      pkgName,
+      version,
+      hash,
+    }:
+    # testers.runCommand ensures we have an FOD, so the command has network access,
+    #  yet the test is rerun whenever one of its inputs changes.
+    testers.runCommand {
+      name = "homf-${subcommand}-${pkgName}";
+      script = "homf ${subcommand} --directory $out ${pkgName} ${version}";
+      nativeBuildInputs = [
+        cacert
+        homf
+      ];
+      inherit hash;
+    };
+in
+
+lib.mapAttrs Homf {
+  pypi = {
+    pkgName = "homf";
+    version = "1.1.1"; # pinned so updating homf won't invalidate hashes
+    hash = "sha256-zpdt7+zTaGkLG6xYoTZVw/kUek0/MrCqvljfLxNB94A=";
+  };
+
+  github = {
+    pkgName = "duckinator/homf";
+    version = "v1.1.1";
+    hash = "sha256-NeEz8wZqDWYUnrgsknXWHzhWdk8cPW8mknKS3+/dngQ=";
+  };
+}