nixos: evaluate assertions at toplevel, not at systemPackages
Fixes #2340
This commit is contained in:
@@ -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 "[1;31mwarning: ${w}[0m" 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>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user