about summary refs log tree commit diff
path: root/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/dhall/build-dhall-directory-package.nix')
-rw-r--r--pkgs/development/interpreters/dhall/build-dhall-directory-package.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix b/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix
new file mode 100644
index 000000000000..b4401a85d141
--- /dev/null
+++ b/pkgs/development/interpreters/dhall/build-dhall-directory-package.nix
@@ -0,0 +1,25 @@
+{ buildDhallPackage, lib }:
+
+# This is a minor variation on `buildDhallPackage` that splits the `code`
+# argument into `src` and `file` in such a way that you can easily override
+# the `file`
+#
+# This function is used by `dhall-to-nixpkgs` when given a directory
+lib.makeOverridable
+  ( { # Arguments passed through to `buildDhallPackage`
+      name
+    , dependencies ? []
+    , source ? false
+
+    , src
+    , # The file to import, relative to the root directory
+      file ? "package.dhall"
+    }:
+
+    buildDhallPackage {
+      inherit name dependencies source;
+
+      code = "${src}/${file}";
+    }
+  )
+