summary refs log tree commit diff
path: root/nixos/modules/system/boot/systemd/initrd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/system/boot/systemd/initrd.nix')
-rw-r--r--nixos/modules/system/boot/systemd/initrd.nix21
1 files changed, 20 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd/initrd.nix b/nixos/modules/system/boot/systemd/initrd.nix
index f987aca34f1..6f991b84bbd 100644
--- a/nixos/modules/system/boot/systemd/initrd.nix
+++ b/nixos/modules/system/boot/systemd/initrd.nix
@@ -1,4 +1,4 @@
-{ lib, config, utils, pkgs, ... }:
+{ lib, options, config, utils, pkgs, ... }:
 
 with lib;
 
@@ -338,6 +338,25 @@ in {
   };
 
   config = mkIf (config.boot.initrd.enable && cfg.enable) {
+    assertions = map (name: {
+      assertion = config.boot.initrd.${name} == "";
+      message = ''
+        systemd stage 1 does not support 'boot.initrd.${name}'. Please
+        convert it to analogous systemd units in 'boot.initrd.systemd'.
+
+          Definitions:
+          ${lib.concatMapStringsSep "\n" ({ file, ... }: "- ${file}") options.boot.initrd.${name}.definitionsWithLocations}
+      '';
+    }) [
+      "preFailCommands"
+      "preDeviceCommands"
+      "preLVMCommands"
+      "postDeviceCommands"
+      "postMountCommands"
+      "extraUtilsCommands"
+      "extraUtilsCommandsTest"
+    ];
+
     system.build = { inherit initialRamdisk; };
 
     boot.initrd.availableKernelModules = [