programs: unl0kr: auto-derive the user option

This commit is contained in:
Colin 2024-02-20 07:21:22 +00:00
parent b0f62830a5
commit 36ad2d5421

View File

@ -50,8 +50,11 @@ in
};
options.user = mkOption {
type = types.str;
# TODO: derive this from sane.programs...enableFor.user.* info
default = "colin";
description = ''
which user to login by default.
unl0kr is just a virtual keyboard for entering a password: one has to choose the user to login before launching it.
on a typical single-user install, leave this unset and the user will be chosen based on who this package is installed for.
'';
};
options.afterLogin = mkOption {
type = types.nullOr types.str;
@ -76,10 +79,16 @@ in
exposed for debugging.
'';
};
config = lib.mkMerge (lib.mapAttrsToList
(userName: en: lib.optionalAttrs en {
user = lib.mkDefault userName;
})
cfg.enableFor.user
);
};
};
# lib.mkAfter so that launching the DE happens *after* any other .profile setup.
# alternatively, we could recurse: exec a new login shell with some env-var signalling to not launch the DE,
# run with `-c "{cfg.afterLogin}"`