diff --git a/nixos/modules/services/system/nix-daemon.nix b/nixos/modules/services/system/nix-daemon.nix index 97a5752bd35c..ab799c778a34 100644 --- a/nixos/modules/services/system/nix-daemon.nix +++ b/nixos/modules/services/system/nix-daemon.nix @@ -102,10 +102,14 @@ in systemd.services.nix-daemon = { # Nix assumes it should use `daemon` if it isn't root, so we have to set `NIX_REMOTE` anyway environment.NIX_REMOTE = "local?use-roots-daemon=true"; + # Nix wants a HOME it can access to cache substituter contents, among other things. + environment.HOME = "%S/nix-daemon"; serviceConfig = { User = cfg.daemonUser; Group = cfg.daemonGroup; + StateDirectory = "nix-daemon"; + # Empty string needed to disable old Exec ExecStart = [ ""