From e6014511f58b986344423c360b17206a64a42920 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Mon, 18 Sep 2023 15:50:37 +0200 Subject: [PATCH] Wait for the NFS hut store to be mounted --- m/module/shared-nix-store.nix | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/m/module/shared-nix-store.nix b/m/module/shared-nix-store.nix index 225bdc0..cde993b 100644 --- a/m/module/shared-nix-store.nix +++ b/m/module/shared-nix-store.nix @@ -25,7 +25,27 @@ fileSystems."/nix//store" = { device = "overlay"; fsType = "overlay"; - options = [ "lowerdir=/mnt/hut-nix-store,upperdir=/nix/store,workdir=/mnt/nix-work" ]; + options = [ + "lowerdir=/mnt/hut-nix-store,upperdir=/nix/store,workdir=/mnt/nix-work" + "x-systemd.requires-mounts-for=/nix/store" + # We need to wait for the NFS mount + "x-systemd.requires-mounts-for=/mnt/hut-nix-store" + ]; depends = [ "/nix/store" "/mnt/hut-nix-store" "/mnt/nix-work" ]; }; + + # Maybe we should move it to a systemd mount, so we avoid the /nix//store + # hack. Example (not tested): + # systemd.mounts = [ + # { + # what = "overlay"; + # type = "overlay"; + # where = "/nix/store"; + # options = "lowerdir=/mnt/hut-nix-store,upperdir=/nix/store,workdir=/mnt/nix-work"; + # description = "Overlay nix store mount"; + # requires = [ "hut-nix-store.mount" ]; + # after = [ "mnt-hut\\x2dnix\\x2dstore.mount" ]; + # before = [ "nix-daemon.service" ]; + # } + # ]; }