@@ -93,49 +93,52 @@ let
9393 ${config.system.extraSystemBuilderCmds}
9494 '';
9595
96− # Handle assertions
97−
98− failed = map (x: x.message) (filter (x: !x.assertion) config.assertions);
99−
100− showWarnings = res: fold (w: x: builtins.trace "[1;31mwarning: ${w}[0m" x) res config.warnings;
101−
10296 # Putting it all together. This builds a store path containing
10397 # symlinks to the various parts of the built configuration (the
10498 # kernel, systemd units, init scripts, etc.) as well as a script
10599 # `switch-to-configuration' that activates the configuration and
106100 # makes it bootable.
107− baseSystem = showWarnings (
108− if [] == failed then pkgs.stdenvNoCC.mkDerivation {
109− name = let hn = config.networking.hostName;
110− nn = if (hn != "") then hn else "unnamed";
111− in "nixos-system-${nn}-${config.system.nixos.label}";
112− preferLocalBuild = true;
113− allowSubstitutes = false;
114− buildCommand = systemBuilder;
115−
116− inherit (pkgs) utillinux coreutils;
117− systemd = config.systemd.package;
118− shell = "${pkgs.bash}/bin/sh";
119−
120− inherit children;
121− kernelParams = config.boot.kernelParams;
122− installBootLoader =
123− config.system.build.installBootLoader
124− or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
125− activationScript = config.system.activationScripts.script;
126− nixosLabel = config.system.nixos.label;
127−
128− configurationName = config.boot.loader.grub.configurationName;
129−
130− # Needed by switch-to-configuration.
131−
132− perl = "${pkgs.perl}/bin/perl " + (concatMapStringsSep " " (lib: "-I${lib}/${pkgs.perl.libPrefix}") (with pkgs.perlPackages; [ FileSlurp NetDBus XMLParser XMLTwig ]));
133− } else throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failed)}");
101+ baseSystem = pkgs.stdenvNoCC.mkDerivation {
102+ name = let hn = config.networking.hostName;
103+ nn = if (hn != "") then hn else "unnamed";
104+ in "nixos-system-${nn}-${config.system.nixos.label}";
105+ preferLocalBuild = true;
106+ allowSubstitutes = false;
107+ buildCommand = systemBuilder;
108+
109+ inherit (pkgs) utillinux coreutils;
110+ systemd = config.systemd.package;
111+ shell = "${pkgs.bash}/bin/sh";
112+
113+ inherit children;
114+ kernelParams = config.boot.kernelParams;
115+ installBootLoader =
116+ config.system.build.installBootLoader
117+ or "echo 'Warning: do not know how to make this configuration bootable; please enable a boot loader.' 1>&2; true";
118+ activationScript = config.system.activationScripts.script;
119+ nixosLabel = config.system.nixos.label;
120+
121+ configurationName = config.boot.loader.grub.configurationName;
122+
123+ # Needed by switch-to-configuration.
124+
125+ perl = "${pkgs.perl}/bin/perl " + (concatMapStringsSep " " (lib: "-I${lib}/${pkgs.perl.libPrefix}") (with pkgs.perlPackages; [ FileSlurp NetDBus XMLParser XMLTwig ]));
126+ };
127+
128+ # Handle assertions and warnings
129+
130+ failedAssertions = map (x: x.message) (filter (x: !x.assertion) config.assertions);
131+
132+ showWarnings = res: fold (w: x: builtins.trace "[1;31mwarning: ${w}[0m" x) res config.warnings;
133+
134+ baseSystemAssertWarn = if failedAssertions != []
135+ then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
136+ else showWarnings baseSystem;
134137
135138 # Replace runtime dependencies
136139 system = fold ({ oldDependency, newDependency }: drv:
137140 pkgs.replaceDependency { inherit oldDependency newDependency drv; }
138− ) baseSystem config.system.replaceRuntimeDependencies;
141+ ) baseSystemAssertWarn config.system.replaceRuntimeDependencies;
139142
140143in
141144