3
0
Fork 0
forked from mirrors/nixpkgs

* eval-release.nix: force nix-instantiate to include nested attribute

sets.

svn path=/nixpkgs/trunk/; revision=31500
This commit is contained in:
Eelco Dolstra 2012-01-12 16:59:58 +00:00
parent c3cf936ff1
commit d62848cd2c
2 changed files with 15 additions and 8 deletions

View file

@ -2,23 +2,30 @@
# attribute with the expected `system' argument). Too bad
# nix-instantiate can't to do this.
let
with import ../../pkgs/lib;
lib = (import ../.. {}).lib;
let
rel = removeAttrs (import ../../pkgs/top-level/release.nix) [ "tarball" "xbursttools" ];
seqList = xs: res: lib.fold (x: xs: lib.seq x xs) res xs;
seqList = xs: res: fold (x: xs: seq x xs) res xs;
strictAttrs = as: seqList (lib.attrValues as) as;
strictAttrs = as: seqList (attrValues as) as;
maybe = as: let y = builtins.tryEval (strictAttrs as); in if y.success then y.value else builtins.trace "FAIL" null;
call = attrs: lib.flip lib.mapAttrs attrs
(n: v: builtins.trace n (
call = attrs: flip mapAttrs attrs
(n: v: /* builtins.trace n */ (
if builtins.isFunction v then maybe (v { system = "i686-linux"; })
else if builtins.isAttrs v then call v
else null
));
in call rel
# Add the recurseForDerivations attribute to ensure that
# nix-instantiate recurses into nested attribute sets.
recurse = attrs:
if isDerivation attrs
then attrs
else { recurseForDerivations = true; } // mapAttrs (n: v: recurse v) attrs;
in recurse (call rel)