summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorNicolas B. Pierron <nicolas.b.pierron@gmail.com>2014-12-19 23:00:00 +0100
committerNicolas B. Pierron <nicolas.b.pierron@gmail.com>2014-12-19 23:00:00 +0100
commitb2abfe54b3da8eddda3135561c0c841c3023966d (patch)
tree1ae1ff5cb57e32e1f34d377378014f5357d1bc78 /nixos/modules/installer
parent9db6a84f0bcce1602f17eca3fa17f5a016a93aac (diff)
downloadnixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.tar
nixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.tar.gz
nixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.tar.bz2
nixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.tar.lz
nixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.tar.xz
nixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.tar.zst
nixlib-b2abfe54b3da8eddda3135561c0c841c3023966d.zip
nixos-option: Print derivation outPath within attribute sets and list, when the strict mode is used.
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-option.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh
index a2b963d7661b..b5f69f07826c 100644
--- a/nixos/modules/installer/tools/nixos-option.sh
+++ b/nixos/modules/installer/tools/nixos-option.sh
@@ -76,14 +76,23 @@ evalAttr(){
   local prefix="$1"
   local strict="$2"
   local suffix="$3"
+
+  # If strict is set, then set it to "true".
+  test -n "$strict" && strict=true
+
   evalNix ${strict:+--strict} <<EOF
 let
   reach = attrs: attrs${option:+.$option}${suffix:+.$suffix};
   nixos = import <nixos> {};
   nixpkgs = import <nixpkgs> {};
+  strict = ${strict:-false};
   cleanOutput = x: with nixpkgs.lib;
     if isDerivation x then x.outPath
     else if isFunction x then "<CODE>"
+    else if strict then
+      if isAttrs x then mapAttrs (n: cleanOutput) x
+      else if isList x then map cleanOutput x
+      else x
     else x;
 in
   cleanOutput (reach nixos.$prefix)