summary refs log tree commit diff
path: root/lib/attrsets.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/attrsets.nix')
-rw-r--r--lib/attrsets.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 20be2002402..2300ee9c000 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -221,6 +221,16 @@ rec {
   isDerivation = x: isAttrs x && x ? type && x.type == "derivation";
 
 
+  /* Convert a store path to a fake derivation. */
+  toDerivation = path:
+    let path' = builtins.storePath path; in
+    { type = "derivation";
+      name = builtins.unsafeDiscardStringContext (builtins.substring 33 (-1) (baseNameOf path'));
+      outPath = path';
+      outputs = [ "out" ];
+    };
+
+
   /* If the Boolean `cond' is true, return the attribute set `as',
      otherwise an empty attribute set. */
   optionalAttrs = cond: as: if cond then as else {};