nixos/nixos-init: add more strict assertions for required config

This commit is contained in:
nikstur
2025-10-10 21:55:09 +02:00
parent 45f33f264d
commit 8f5d10fd7e
2 changed files with 12 additions and 6 deletions

View File

@@ -24,7 +24,15 @@ in
assertions = [
{
assertion = config.boot.initrd.systemd.enable;
message = "nixos-init can only be used with systemd initrd";
message = "nixos-init can only be used with boot.initrd.systemd.enable";
}
{
assertion = config.system.etc.overlay.enable;
message = "nixos-init can only be used with system.etc.overlay.enable";
}
{
assertion = config.services.userborn.enable || config.systemd.sysusers.enable;
message = "nixos-init can only be used with services.userborn.enable or systemd.sysusers.enable";
}
];
};

View File

@@ -8,11 +8,9 @@
nodes.machine =
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/profiles/perlless.nix"
];
virtualisation.mountHostNixStore = false;
virtualisation.useNixStoreImage = true;
boot.initrd.systemd.enable = true;
system.etc.overlay.enable = true;
services.userborn.enable = true;
system.nixos-init.enable = true;
# Forcibly set this to only these specific values.