home: check username being non-empty through its type

This commit is contained in:
Benedikt Rips 2026-06-24 15:52:17 +02:00 committed by Austin Horstman
parent c0b7cadd81
commit 937e85df03

View file

@ -184,7 +184,7 @@ in
options = {
home.username = mkOption {
type = types.str;
type = types.nonEmptyStr;
defaultText = literalExpression ''
"$USER" for state version < 20.09,
undefined for state version 20.09
@ -578,13 +578,6 @@ in
};
config = {
assertions = [
{
assertion = config.home.username != "";
message = "Username could not be determined";
}
];
warnings =
let
hmRelease = config.home.version.release;