diff --git a/nixos/modules/system/activation/nixos-init.nix b/nixos/modules/system/activation/nixos-init.nix index 5fc2f1bf0e07..a2928cf1e0a1 100644 --- a/nixos/modules/system/activation/nixos-init.nix +++ b/nixos/modules/system/activation/nixos-init.nix @@ -34,6 +34,14 @@ in assertion = config.services.userborn.enable || config.systemd.sysusers.enable; message = "nixos-init can only be used with services.userborn.enable or systemd.sysusers.enable"; } + { + assertion = config.boot.postBootCommands == ""; + message = "nixos-init cannot be used with boot.postBootCommands"; + } + { + assertion = config.powerManagement.powerUpCommands == ""; + message = "nixos-init cannot be used with powerManagement.powerUpCommands"; + } ]; }; } diff --git a/nixos/tests/activation/nixos-init.nix b/nixos/tests/activation/nixos-init.nix index 0635efba28b8..2b3ee5c5ec55 100644 --- a/nixos/tests/activation/nixos-init.nix +++ b/nixos/tests/activation/nixos-init.nix @@ -11,6 +11,7 @@ boot.initrd.systemd.enable = true; system.etc.overlay.enable = true; services.userborn.enable = true; + boot.postBootCommands = lib.mkForce ""; system.nixos-init.enable = true; # Forcibly set this to only these specific values.