Merge pull request 'users: fix eval when used to manage root' (#4319) from push-qnllumxpxumt into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4319
This commit is contained in:
Michael Hoang
2025-07-13 02:35:35 +00:00
2 changed files with 5 additions and 6 deletions

View File

@@ -11,7 +11,7 @@
roles.default = { roles.default = {
interface = interface =
{ lib, ... }: { config, lib, ... }:
{ {
options = { options = {
user = lib.mkOption { user = lib.mkOption {
@@ -28,8 +28,8 @@
Effects: Effects:
- *enabled* (`true`) - Prompt for a passwort during the machine installation or update workflow. - *enabled* (`true`) - Prompt for a password during the machine installation or update workflow.
- *disabled* (`false`) - Generate a passwort during the machine installation or update workflow. - *disabled* (`false`) - Generate a password during the machine installation or update workflow.
The password can be shown in two steps: The password can be shown in two steps:
@@ -39,7 +39,8 @@
}; };
regularUser = lib.mkOption { regularUser = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = config.user != "root";
defaultText = lib.literalExpression "config.user != \"root\"";
example = false; example = false;
description = '' description = ''
Whether the user should be a regular user or a system user. Whether the user should be a regular user or a system user.

View File

@@ -13,8 +13,6 @@
roles.default.machines."server".settings = { roles.default.machines."server".settings = {
user = "root"; user = "root";
prompt = false; prompt = false;
# Important: 'root' must not be a regular user. See: https://github.com/NixOS/nixpkgs/issues/424404
regularUser = false;
}; };
}; };
user-password-test = { user-password-test = {