nixos: evaluate assertions at toplevel, not at systemPackages

Fixes #2340
This commit is contained in:
Shea Levy
2014-04-22 14:09:02 -04:00
parent 5ba24cc8ea
commit 7d1ddae58e
2 changed files with 24 additions and 36 deletions
+1 -19
View File
@@ -2,14 +2,6 @@
with lib;
let
failed = map (x: x.message) (filter (x: !x.assertion) config.assertions);
showWarnings = res: fold (w: x: builtins.trace "warning: ${w}" x) res config.warnings;
in
{
options = {
@@ -38,15 +30,5 @@ in
};
};
config = {
# This option is evaluated always. Thus the assertions are checked
# as well. Hacky!
environment.systemPackages = showWarnings (
if [] == failed then []
else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
};
# impl of assertions is in <nixos/modules/system/activation/top-level.nix>
}