mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-15 05:21:06 +01:00
home-environment: add home.uid option
Add a home.uid option similar to home.username. When set, the activation script verifies the current UID matches the expected value using the new checkUid function. When using the NixOS or nix-darwin modules, home.uid is auto-discovered from users.users.<name>.uid when that value is set. This is useful for constructing paths that depend on the user's UID, such as /run/user/<uid> paths for gpg-agent sockets or other user-specific runtime directories.
This commit is contained in:
parent
d441981b20
commit
a521eab881
6 changed files with 38 additions and 0 deletions
|
|
@ -193,6 +193,13 @@ in
|
|||
description = "The user's username.";
|
||||
};
|
||||
|
||||
home.uid = mkOption {
|
||||
type = types.nullOr types.ints.unsigned;
|
||||
default = null;
|
||||
example = 1000;
|
||||
description = "The user's uid.";
|
||||
};
|
||||
|
||||
home.homeDirectory = mkOption {
|
||||
type = types.path;
|
||||
defaultText = literalExpression ''
|
||||
|
|
@ -842,6 +849,9 @@ in
|
|||
if [[ ! -v SKIP_SANITY_CHECKS ]]; then
|
||||
checkUsername ${lib.escapeShellArg config.home.username}
|
||||
checkHomeDirectory ${lib.escapeShellArg config.home.homeDirectory}
|
||||
${lib.optionalString (config.home.uid != null) ''
|
||||
checkUid ${toString config.home.uid}
|
||||
''}
|
||||
fi
|
||||
|
||||
${lib.optionalString config.home.activationGenerateGcRoot ''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue