mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 18:03:04 +00:00
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 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)
|
||||
|
Loading…
Reference in New Issue
Block a user