summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorSilvan Mosberger <github@infinisil.com>2020-12-18 16:42:42 +0100
committerSilvan Mosberger <github@infinisil.com>2020-12-18 16:44:37 +0100
commit9e6737710c4fb2613850e699178b23d54f1a3261 (patch)
tree9ba4d7163707bbc92e8a5917680426b0a01836f4 /nixos/modules/system/activation/top-level.nix
parentfd1cc29974de2255d407a706f23aacdfb76f543b (diff)
downloadnixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.tar
nixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.tar.gz
nixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.tar.bz2
nixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.tar.lz
nixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.tar.xz
nixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.tar.zst
nixpkgs-9e6737710c4fb2613850e699178b23d54f1a3261.zip
Revert "Module-builtin assertions, disabling assertions and submodule assertions"
Diffstat (limited to 'nixos/modules/system/activation/top-level.nix')
-rw-r--r--nixos/modules/system/activation/top-level.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 17b62ad9569..03d7e749323 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -117,10 +117,18 @@ let
     perl = "${pkgs.perl}/bin/perl " + (concatMapStringsSep " " (lib: "-I${lib}/${pkgs.perl.libPrefix}") (with pkgs.perlPackages; [ FileSlurp NetDBus XMLParser XMLTwig ]));
   };
 
+  # Handle assertions and warnings
+
+  failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
+
+  baseSystemAssertWarn = if failedAssertions != []
+    then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
+    else showWarnings config.warnings baseSystem;
+
   # Replace runtime dependencies
   system = fold ({ oldDependency, newDependency }: drv:
       pkgs.replaceDependency { inherit oldDependency newDependency drv; }
-    ) baseSystem config.system.replaceRuntimeDependencies;
+    ) baseSystemAssertWarn config.system.replaceRuntimeDependencies;
 
 in