nixos-option: Print derivation outPath within attribute sets and list, when the strict mode is used.

This commit is contained in:
Nicolas B. Pierron 2014-12-19 23:00:00 +01:00
parent 9db6a84f0b
commit b2abfe54b3

View File

@ -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)