aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/imported-drv-to-derivation.nix
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/imported-drv-to-derivation.nix')
-rw-r--r--src/libexpr/imported-drv-to-derivation.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/libexpr/imported-drv-to-derivation.nix b/src/libexpr/imported-drv-to-derivation.nix
new file mode 100644
index 000000000..eab8b050e
--- /dev/null
+++ b/src/libexpr/imported-drv-to-derivation.nix
@@ -0,0 +1,21 @@
+attrs @ { drvPath, outputs, name, ... }:
+
+let
+
+ commonAttrs = (builtins.listToAttrs outputsList) //
+ { all = map (x: x.value) outputsList;
+ inherit drvPath name;
+ type = "derivation";
+ };
+
+ outputToAttrListElement = outputName:
+ { name = outputName;
+ value = commonAttrs // {
+ outPath = builtins.getAttr outputName attrs;
+ inherit outputName;
+ };
+ };
+
+ outputsList = map outputToAttrListElement outputs;
+
+in (builtins.head outputsList).value