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

systemd: do not install systemd files when user is root (#2454)

For the user root, there are no user services provided by systemd.
Therefore, these files will never be used.
This commit is contained in:
Tobias Happ 2021-11-23 07:06:43 +01:00 committed by GitHub
parent 15ae861e1b
commit c2aa831491
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 1 deletions

View file

@ -258,7 +258,8 @@ in {
# If we run under a Linux system we assume that systemd is
# available, in particular we assume that systemctl is in PATH.
(mkIf pkgs.stdenv.isLinux {
# Do not install any user services if username is root.
(mkIf (pkgs.stdenv.isLinux && config.home.username != "root") {
xdg.configFile = mkMerge [
(lib.listToAttrs ((buildServices "service" cfg.services)
++ (buildServices "slices" cfg.slices)