Draft: Mount the nix store from hut in compute nodes #66

Closed
rarias wants to merge 11 commits from shared-nix-store into master
3 changed files with 26 additions and 3 deletions
Showing only changes of commit 77b41a90e2 - Show all commits

View File

@ -11,9 +11,17 @@
# One solution is to make the nix-daemon.socket depend only on the socket # One solution is to make the nix-daemon.socket depend only on the socket
# patch (which is already covered by ConditionPathIsReadWrite = # patch (which is already covered by ConditionPathIsReadWrite =
# /nix/var/nix/daemon-socket), instead on the /nix/store. # /nix/var/nix/daemon-socket), instead on the /nix/store.
systemd.sockets.nix-daemon.unitConfig = { #
RequiresMountsFor = "/nix/var/nix/daemon-socket"; # Using systemd.sockets.nix-daemon.unitConfig.RequiresMountsFor =
}; # "/nix/var/nix/daemon-socket" doesn't work, as the the mount options get
# added by systemd when the override config is merged with the one that Nix
# provides:
#
# owl2% sudo systemctl show nix-daemon.socket | grep RequiresMountsFor
# RequiresMountsFor=/nix/store /nix/var/nix/daemon-socket/socket /nix/var/nix/daemon-socket
#
# To fix this, the Nix package is patched to only depend on /nix/var instead.
# See ../../pkgs/overlay.nix for details.
# Mount the hut nix store via NFS in read-only mode. # Mount the hut nix store via NFS in read-only mode.
fileSystems."/mnt/hut-nix-store" = { fileSystems."/mnt/hut-nix-store" = {

11
pkgs/nix-socket.patch Normal file
View File

@ -0,0 +1,11 @@
--- a/misc/systemd/nix-daemon.socket.in 1970-01-01 01:00:01.000000000 +0100
+++ b/misc/systemd/nix-daemon.socket.in 2023-09-18 17:53:32.351760208 +0200
@@ -1,7 +1,7 @@
[Unit]
Description=Nix Daemon Socket
Before=multi-user.target
-RequiresMountsFor=@storedir@
+RequiresMountsFor=@localstatedir@
ConditionPathIsReadWrite=@localstatedir@/nix/daemon-socket
[Socket]

View File

@ -32,4 +32,8 @@ final: prev:
lua = prev.lua5_4; lua = prev.lua5_4;
fmt = prev.fmt_8; fmt = prev.fmt_8;
}) ceph ceph-client; }) ceph ceph-client;
nix = prev.nix.overrideAttrs (old: {
patches = old.patches ++ [ ./nix-socket.patch ];
});
} }