diff --git a/nix/modules/hive-c0re.nix b/nix/modules/hive-c0re.nix index dbe4c3c4..4e5cb42c 100644 --- a/nix/modules/hive-c0re.nix +++ b/nix/modules/hive-c0re.nix @@ -771,6 +771,15 @@ in ]; # Writable HOME for nix's caches (see environment.HOME above). StateDirectory = "hive-priv"; + # With ProtectSystem=strict the root filesystem is read-only inside + # hive-priv. When `nixos-container create/update` invokes nix, nix + # creates a temporary result symlink in its working directory. Without + # an explicit WorkingDirectory the cwd is / (inherited from systemd), + # which is read-only under strict, causing: + # error: creating symlink "/.tmp.tmp-..." -> ...: Read-only file system + # Point the working directory at the writable StateDirectory so nix + # drops its temp symlink there instead. + WorkingDirectory = "/var/lib/hive-priv"; # nix (run here as root for `nixos-container update --flake # /var/lib/hyperhive/meta#`) fetches the hive-core-owned # meta/applied repos; libgit2 refuses them without safe.directory.