about summary refs log tree commit diff
path: root/third_party/nix/corepkgs/imported-drv-to-derivation.nix
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/corepkgs/imported-drv-to-derivation.nix')
-rw-r--r--third_party/nix/corepkgs/imported-drv-to-derivation.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/third_party/nix/corepkgs/imported-drv-to-derivation.nix b/third_party/nix/corepkgs/imported-drv-to-derivation.nix
new file mode 100644
index 000000000000..eab8b050e8ff
--- /dev/null
+++ b/third_party/nix/corepkgs/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