about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/trivial.nix9
-rw-r--r--lib/types.nix2
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 760a74ce6664..e073da4900cc 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -41,4 +41,13 @@ rec {
     pathExists readFile isBool isFunction
     isInt add sub lessThan;
 
+  # Return the Nixpkgs version number.
+  nixpkgsVersion =
+    let suffixFile = ../.version-suffix; in
+    readFile ../.version
+    + (if pathExists suffixFile then readFile suffixFile else "pre-git");
+
+  # Whether we're being called by nix-shell.  This is useful to  
+  inNixShell = builtins.getEnv "IN_NIX_SHELL" == "1";
+
 }
diff --git a/lib/types.nix b/lib/types.nix
index afc8f80eb0ea..9bce56bf8073 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -132,7 +132,7 @@ rec {
             { inherit (def) file;
               value = listToAttrs (
                 imap (elemIdx: elem:
-                  { name = "${elem.name or "unnamed"}-${toString defIdx}.${toString elemIdx}";
+                  { name = elem.name or "unnamed-${toString defIdx}.${toString elemIdx}";
                     value = elem;
                   }) def.value);
             }