nixos-option: Print derivation outPath within attribute sets and list, when the strict mode is used.
This commit is contained in:
parent
9db6a84f0b
commit
b2abfe54b3
@ -76,14 +76,23 @@ evalAttr(){
|
|||||||
local prefix="$1"
|
local prefix="$1"
|
||||||
local strict="$2"
|
local strict="$2"
|
||||||
local suffix="$3"
|
local suffix="$3"
|
||||||
|
|
||||||
|
# If strict is set, then set it to "true".
|
||||||
|
test -n "$strict" && strict=true
|
||||||
|
|
||||||
evalNix ${strict:+--strict} <<EOF
|
evalNix ${strict:+--strict} <<EOF
|
||||||
let
|
let
|
||||||
reach = attrs: attrs${option:+.$option}${suffix:+.$suffix};
|
reach = attrs: attrs${option:+.$option}${suffix:+.$suffix};
|
||||||
nixos = import <nixos> {};
|
nixos = import <nixos> {};
|
||||||
nixpkgs = import <nixpkgs> {};
|
nixpkgs = import <nixpkgs> {};
|
||||||
|
strict = ${strict:-false};
|
||||||
cleanOutput = x: with nixpkgs.lib;
|
cleanOutput = x: with nixpkgs.lib;
|
||||||
if isDerivation x then x.outPath
|
if isDerivation x then x.outPath
|
||||||
else if isFunction x then "<CODE>"
|
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;
|
else x;
|
||||||
in
|
in
|
||||||
cleanOutput (reach nixos.$prefix)
|
cleanOutput (reach nixos.$prefix)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user