1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

home-manager: verify username and home directory

The generation activation script should be run by the user specified
in `home.username` and `home.homeDirectory`. If some other user runs
the activation script, then files may end up in the wrong place or
with the wrong owner.

This commits adds a check early in the activation script that verifies
that the running user match the user in the configuration.

Fixes #4019
This commit is contained in:
Robert Helgesson 2023-05-26 15:11:22 +02:00
parent bec196cd9b
commit 6a19225683
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 39 additions and 10 deletions

View file

@ -704,6 +704,9 @@ in
${builtins.readFile ./lib-bash/activation-init.sh}
checkUsername ${escapeShellArg config.home.username}
checkHomeDirectory ${escapeShellArg config.home.homeDirectory}
${activationCmds}
'';
in