diff --git a/nixos/default.nix b/nixos/default.nix index 5328e578..4628d1f2 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -60,28 +60,31 @@ in }) cfg.users ); - systemd.services = mapAttrs' (username: usercfg: - nameValuePair ("home-manager-${utils.escapeSystemdPath username}") { - description = "Home Manager environment for ${username}"; - wantedBy = [ "multi-user.target" ]; - wants = [ "nix-daemon.socket" ]; - after = [ "nix-daemon.socket" ]; + systemd.services = mapAttrs' (_: usercfg: + let + username = usercfg.home.username; + in + nameValuePair ("home-manager-${utils.escapeSystemdPath username}") { + description = "Home Manager environment for ${username}"; + wantedBy = [ "multi-user.target" ]; + wants = [ "nix-daemon.socket" ]; + after = [ "nix-daemon.socket" ]; - serviceConfig = { - User = usercfg.home.username; - Type = "oneshot"; - RemainAfterExit = "yes"; - SyslogIdentifier = "hm-activate-${username}"; + serviceConfig = { + User = usercfg.home.username; + Type = "oneshot"; + RemainAfterExit = "yes"; + SyslogIdentifier = "hm-activate-${username}"; - # The activation script is run by a login shell to make sure - # that the user is given a sane Nix environment. - ExecStart = pkgs.writeScript "activate-${username}" '' - #! ${pkgs.stdenv.shell} -el - echo Activating home-manager configuration for ${username} - exec ${usercfg.home.activationPackage}/activate - ''; - }; - } + # The activation script is run by a login shell to make sure + # that the user is given a sane Nix environment. + ExecStart = pkgs.writeScript "activate-${username}" '' + #! ${pkgs.stdenv.shell} -el + echo Activating home-manager configuration for ${username} + exec ${usercfg.home.activationPackage}/activate + ''; + }; + } ) cfg.users; }; }