1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-08 10:01:05 +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:
Bernardo Meurer 2025-12-03 22:52:03 +00:00 committed by Matthieu Coudron
parent d441981b20
commit a521eab881
6 changed files with 38 additions and 0 deletions

View file

@ -53,6 +53,7 @@ let
home.username = config.users.users.${name}.name;
home.homeDirectory = config.users.users.${name}.home;
home.uid = mkIf (config.users.users.${name}.uid != null) config.users.users.${name}.uid;
# Forward `nix.enable` from the OS configuration. The
# conditional is to check whether nix-darwin is new enough