From b8348bf27680a7b60069b37ad83f5d6eb772cec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Mon, 5 Oct 2026 01:08:08 +0800 Subject: [PATCH] fix(mihomo): order the service after its config mount (#382) The config deliberately stays out of the store, under the home directory, which is a persistent bind mount on tmpfs-root hosts. When the service and the mount are introduced in the same activation, mihomo can start before the mount is up and fail with "Failed to set up credentials: No such file or directory", making the switch report status 4. Add RequiresMountsFor so the mount is brought up and ordered before the service. --- modules/nixos/desktop/networking/mihomo/default.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/nixos/desktop/networking/mihomo/default.nix b/modules/nixos/desktop/networking/mihomo/default.nix index 3baabd49..f069e4c3 100644 --- a/modules/nixos/desktop/networking/mihomo/default.nix +++ b/modules/nixos/desktop/networking/mihomo/default.nix @@ -31,5 +31,11 @@ in webui = pkgs.metacubexd; tunMode = true; }; + + # The config deliberately stays out of the store, under the user's home. On + # tmpfs-root hosts that path is a persistent bind mount, so make the service + # wait for it: otherwise activation can start mihomo before the mount is up + # and fail with "Failed to set up credentials: No such file or directory". + systemd.services.mihomo.unitConfig.RequiresMountsFor = builtins.dirOf configFile; }; }