Improve assertions for etc.overlay
and systemd-sysusers
(#332516)
This commit is contained in:
commit
15f80d9120
@ -68,14 +68,10 @@ in
|
||||
assertion = config.system.activationScripts.users == "";
|
||||
message = "system.activationScripts.users has to be empty to use systemd-sysusers";
|
||||
}
|
||||
{
|
||||
assertion = config.users.mutableUsers -> config.system.etc.overlay.enable;
|
||||
message = "config.users.mutableUsers requires config.system.etc.overlay.enable.";
|
||||
}
|
||||
] ++ (lib.mapAttrsToList
|
||||
(_username: opts: {
|
||||
(username: opts: {
|
||||
assertion = !opts.isNormalUser;
|
||||
message = "systemd-sysusers doesn't create normal users. You can currently only use it to create system users.";
|
||||
message = "${username} is a normal user. systemd-sysusers doesn't create normal users, only system users.";
|
||||
})
|
||||
userCfg.users)
|
||||
++ lib.mapAttrsToList
|
||||
|
@ -26,13 +26,6 @@
|
||||
assertion = lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.6";
|
||||
message = "`system.etc.overlay.enable requires a newer kernel, at least version 6.6";
|
||||
}
|
||||
{
|
||||
assertion = config.systemd.sysusers.enable -> (config.users.mutableUsers == config.system.etc.overlay.mutable);
|
||||
message = ''
|
||||
When using systemd-sysusers and mounting `/etc` via an overlay, users
|
||||
can only be mutable when `/etc` is mutable and vice versa.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "loop" "erofs" "overlay" ];
|
||||
|
Loading…
Reference in New Issue
Block a user