mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
* eval-release.nix: force nix-instantiate to include nested attribute
sets. svn path=/nixpkgs/trunk/; revision=31500
This commit is contained in:
parent
c3cf936ff1
commit
d62848cd2c
|
@ -2,23 +2,30 @@
|
||||||
# attribute with the expected `system' argument). Too bad
|
# attribute with the expected `system' argument). Too bad
|
||||||
# nix-instantiate can't to do this.
|
# 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" ];
|
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;
|
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
|
call = attrs: flip mapAttrs attrs
|
||||||
(n: v: builtins.trace n (
|
(n: v: /* builtins.trace n */ (
|
||||||
if builtins.isFunction v then maybe (v { system = "i686-linux"; })
|
if builtins.isFunction v then maybe (v { system = "i686-linux"; })
|
||||||
else if builtins.isAttrs v then call v
|
else if builtins.isAttrs v then call v
|
||||||
else null
|
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)
|
||||||
|
|
|
@ -177,7 +177,7 @@ let
|
||||||
|
|
||||||
# Applying this to an attribute set will cause nix-env to look
|
# Applying this to an attribute set will cause nix-env to look
|
||||||
# inside the set for derivations.
|
# inside the set for derivations.
|
||||||
recurseIntoAttrs = attrs: attrs // {recurseForDerivations = true;};
|
recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
|
||||||
|
|
||||||
builderDefs = lib.composedArgsAndFun (import ../build-support/builder-defs/builder-defs.nix) {
|
builderDefs = lib.composedArgsAndFun (import ../build-support/builder-defs/builder-defs.nix) {
|
||||||
inherit stringsWithDeps lib stdenv writeScript
|
inherit stringsWithDeps lib stdenv writeScript
|
||||||
|
|
Loading…
Reference in a new issue