Fix NixOps evaluation
This commit is contained in:
parent
259f7a93b1
commit
9a8516438e
2 changed files with 11 additions and 9 deletions
|
@ -22,35 +22,37 @@ rec {
|
||||||
/* Close a set of modules under the ‘imports’ relation. */
|
/* Close a set of modules under the ‘imports’ relation. */
|
||||||
closeModules = modules: args:
|
closeModules = modules: args:
|
||||||
let
|
let
|
||||||
toClosureList = parent: imap (n: x:
|
toClosureList = file: parentKey: imap (n: x:
|
||||||
if isAttrs x || builtins.isFunction x then
|
if isAttrs x || builtins.isFunction x then
|
||||||
unifyModuleSyntax parent "anon-${toString n}" (applyIfFunction x args)
|
unifyModuleSyntax file "${parentKey}:anon-${toString n}" (applyIfFunction x args)
|
||||||
else
|
else
|
||||||
unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args));
|
unifyModuleSyntax (toString x) (toString x) (applyIfFunction (import x) args));
|
||||||
in
|
in
|
||||||
builtins.genericClosure {
|
builtins.genericClosure {
|
||||||
startSet = toClosureList unknownModule modules;
|
startSet = toClosureList unknownModule "" modules;
|
||||||
operator = m: toClosureList m.file m.imports;
|
operator = m: toClosureList m.file m.key m.imports;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Massage a module into canonical form, that is, a set consisting
|
/* Massage a module into canonical form, that is, a set consisting
|
||||||
of ‘options’, ‘config’ and ‘imports’ attributes. */
|
of ‘options’, ‘config’ and ‘imports’ attributes. */
|
||||||
unifyModuleSyntax = file: key: m:
|
unifyModuleSyntax = file: key: m:
|
||||||
if m ? config || m ? options || m ? imports then
|
if m ? config || m ? options || m ? imports then
|
||||||
let badAttrs = removeAttrs m ["imports" "options" "config"]; in
|
let badAttrs = removeAttrs m ["imports" "options" "config" "key"]; in
|
||||||
if badAttrs != {} then
|
if badAttrs != {} then
|
||||||
throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. ${builtins.toXML m} "
|
throw "Module `${key}' has an unsupported attribute `${head (attrNames badAttrs)}'. ${builtins.toXML m} "
|
||||||
else
|
else
|
||||||
{ inherit file key;
|
{ inherit file;
|
||||||
|
key = m.key or key;
|
||||||
imports = m.imports or [];
|
imports = m.imports or [];
|
||||||
options = m.options or {};
|
options = m.options or {};
|
||||||
config = m.config or {};
|
config = m.config or {};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ inherit file key;
|
{ inherit file;
|
||||||
|
key = m.key or key;
|
||||||
imports = m.require or [];
|
imports = m.require or [];
|
||||||
options = {};
|
options = {};
|
||||||
config = removeAttrs m ["require"];
|
config = removeAttrs m ["key" "require"];
|
||||||
};
|
};
|
||||||
|
|
||||||
applyIfFunction = f: arg: if builtins.isFunction f then f arg else f;
|
applyIfFunction = f: arg: if builtins.isFunction f then f arg else f;
|
||||||
|
|
|
@ -236,7 +236,7 @@ in
|
||||||
|
|
||||||
system.build.installBootLoader =
|
system.build.installBootLoader =
|
||||||
if cfg.devices == [] then
|
if cfg.devices == [] then
|
||||||
throw "You must set the ‘boot.loader.grub.device’ option to make the system bootable."
|
throw "You must set the option ‘boot.loader.grub.device’ to make the system bootable."
|
||||||
else
|
else
|
||||||
"PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
|
"PERL5LIB=${makePerlPath [ pkgs.perlPackages.XMLLibXML pkgs.perlPackages.XMLSAX ]} " +
|
||||||
"${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
|
"${pkgs.perl}/bin/perl ${./install-grub.pl} ${grubConfig}";
|
||||||
|
|
Loading…
Reference in a new issue