From 89d7a9bd822724ff5be325c246a628a9caa38c17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Sun, 1 Nov 2026 02:36:00 -0600 Subject: [PATCH] fix(youko): wait for data mounts before tmpfiles setup (#498) systemd-tmpfiles-setup only orders itself after local-fs.target, but the nofail /data submounts can complete later. It then sees /data as the read-only fallback tmpfs and fails to create the Transmission, Immich, RustFS and restic directories at boot. Add RequiresMountsFor for the data mounts and cover the generated unit dependency with an eval test. --- hosts/12kingdoms-youko/homelab-services/disko-fs.nix | 12 ++++++++++++ .../x86_64-linux/tests/youko-tmpfiles/expected.nix | 10 ++++++++++ outputs/x86_64-linux/tests/youko-tmpfiles/expr.nix | 11 +++++++++++ 3 files changed, 33 insertions(+) create mode 100644 outputs/x86_64-linux/tests/youko-tmpfiles/expected.nix create mode 100644 outputs/x86_64-linux/tests/youko-tmpfiles/expr.nix diff --git a/hosts/12kingdoms-youko/homelab-services/disko-fs.nix b/hosts/12kingdoms-youko/homelab-services/disko-fs.nix index 488d989f..7c9caf77 100644 --- a/hosts/12kingdoms-youko/homelab-services/disko-fs.nix +++ b/hosts/12kingdoms-youko/homelab-services/disko-fs.nix @@ -33,6 +33,18 @@ in fileSystems."/data/fileshare/public".depends = [ "/data/fileshare" ]; + # The nofail data mounts finish after local-fs.target. systemd-tmpfiles-setup + # only orders itself after local-fs.target, so without an explicit dependency + # it can run while /data is still the read-only fallback tmpfs and fail to + # create the Transmission, Immich, RustFS and restic directories at boot. + systemd.services.systemd-tmpfiles-setup.unitConfig.RequiresMountsFor = [ + "/data/apps" + "/data/fileshare" + "/data/fileshare/public" + "/data/backups" + "/data/apps-snapshots" + ]; + # By adding this crypttab entry, the disk will be unlocked by systemd-cryptsetup@xxx.service at boot time. # This systemd service is running after agenix, so that the keyfile is already available. environment.etc = { diff --git a/outputs/x86_64-linux/tests/youko-tmpfiles/expected.nix b/outputs/x86_64-linux/tests/youko-tmpfiles/expected.nix new file mode 100644 index 00000000..fe7eb1fa --- /dev/null +++ b/outputs/x86_64-linux/tests/youko-tmpfiles/expected.nix @@ -0,0 +1,10 @@ +{ ... }: +{ + requiresMountsFor = [ + "/data/apps" + "/data/apps-snapshots" + "/data/backups" + "/data/fileshare" + "/data/fileshare/public" + ]; +} diff --git a/outputs/x86_64-linux/tests/youko-tmpfiles/expr.nix b/outputs/x86_64-linux/tests/youko-tmpfiles/expr.nix new file mode 100644 index 00000000..421d852e --- /dev/null +++ b/outputs/x86_64-linux/tests/youko-tmpfiles/expr.nix @@ -0,0 +1,11 @@ +{ + lib, + outputs, + ... +}: +let + unit = outputs.nixosConfigurations.youko.config.systemd.services.systemd-tmpfiles-setup; +in +{ + requiresMountsFor = builtins.sort builtins.lessThan unit.unitConfig.RequiresMountsFor; +}