Skip to content

Commit

Permalink
nixos: reload home conf of logged users
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqui23 committed Apr 8, 2024
1 parent b2a6b28 commit 9bbbe63
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ let
} // optionalAttrs cfg.verbose { VERBOSE = "1"; };
serviceConfig = baseService username;
};
# we use a service separated from nixos-activation
# to keep the logs separate
hmDropIn = "/share/systemd/user/home-manager.service.d";

in {
Expand Down Expand Up @@ -110,8 +112,6 @@ in {
})
(mkIf (cfg.users != { } && cfg.useUserService) {
systemd.user.services.home-manager = (baseUnit "%u") // {
wantedBy = [ "default.target" ];

# user units cannot depend on system units
# TODO: Insert in the script logic for waiting on the nix socket via dbus
# like https://github.com/mogorman/systemd-lock-handler
Expand All @@ -138,6 +138,14 @@ in {
];
}) cfg.users;
environment.pathsToLink = [ hmDropIn ];

# Without this will not reload home conf
# of logged user on system activation
# it will also start the unit on startup
system.userActivationScripts.home-manager = {
text = "${pkgs.systemd}/bin/systemctl --user restart home-manager";
deps = [ ];
};
})
];
}
Expand Down

0 comments on commit 9bbbe63

Please sign in to comment.