Home-manager-auto-upgrade.service failed to load

Issue: home-manager-auto-upgrade.service failed with this error:

× home-manager-auto-upgrade.service - Home Manager upgrade
     Loaded: loaded (/home/sukhman/.config/systemd/user/home-manager-auto-upgrade.service; linked; preset: enabled)
     Active: failed (Result: exit-code) since Sat 2023-09-02 00:00:07 EDT; 5h 16min ago
   Duration: 4.203s
TriggeredBy: ● home-manager-auto-upgrade.timer
   Main PID: 10960 (code=exited, status=1/FAILURE)
        CPU: 3.604s

Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:          at /nix/store/m3z8g57fpnxf4dfz9pp88iji75nzx>
Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:            86|       enableParallelBuilding = true;
Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:            87|       inherit buildCommand name;
Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:              |              ^
Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:            88|       passAsFile = [ "buildCommand" ]
Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:        (stack trace truncated; use '--show-trace' to>
Sep 02 00:00:07 nixos y97w6g0pczpa9ijyldbyvw99xbjy7mz0-home-manager-auto-upgrade[10998]:        error: program 'git' failed with exit code 1
Sep 02 00:00:07 nixos systemd[4074]: home-manager-auto-upgrade.service: Main process exited, code=exited, status=1/FAILURE
Sep 02 00:00:07 nixos systemd[4074]: home-manager-auto-upgrade.service: Failed with result 'exit-code'.
Sep 02 00:00:07 nixos systemd[4074]: home-manager-auto-upgrade.service: Consumed 3.604s CPU time.

My home-manager configuration:

# Home Manager autoupgrade service that periodically updates your Nix channels before running home-manager switch.
  30   │   # automatic home upgrades
  31   │   # fix for https://github.com/nix-community/home-manager/issues/3127
  32   │   systemd.user.sessionVariables = {
  33   │     NIX_PATH = "$HOME/.nix-defexpr/channels:$NIX_PATH";
  34   │   };
  35   │   systemd.user.services.home-manager-auto-upgrade.Service.Environment = let
  36   │     path = lib.makeSearchPath "bin" [ pkgs.nix ];
  37   │   in [
  38   │     "PATH=${path}"
  39   │   ];
  40   │
  41   │   services.home-manager.autoUpgrade.enable = true;
  42   │   services.home-manager.autoUpgrade.frequency = "daily";

My system logs.

NixOS System:

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.49, NixOS, 23.11 (Tapir), 23.11pre521245.aa8aa7e2ea35`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.17.0`
 - channels(sukhman): `"home-manager, nixpkgs-unstable"`
 - channels(root): `"home-manager, nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Can you update manually? It looks like an actual problem with your config…

Edit: It kinda seems to not find git (from the error logs…) So maybe something like

...
path = lib.makeSearchPath "bin" [ pkgs.nix pkgs.git ];
...

might fix it. But that’s just guesswork :sweat_smile:

1 Like

Thank you for your response. I can manually update. Could you please share what I can improve in my configuration?

Thank you. I’m not sure how, but the issue has been resolved.