diff --git a/nixos.nix b/nixos.nix index 67e9cb9..de1ffe5 100644 --- a/nixos.nix +++ b/nixos.nix @@ -493,11 +493,13 @@ in let targetFile = concatPaths [ persistentStoragePath filePath ]; mountPoint = escapeShellArg filePath; + persistentStorageUnit = "${escapeSystemdPath persistentStoragePath}.mount"; in { "persist-${escapeSystemdPath (escapeShellArg targetFile)}" = { description = "Bind mount or link ${escapeShellArg targetFile} to ${mountPoint}"; - wantedBy = [ "local-fs.target" ]; + wantedBy = [ "local-fs.target" persistentStorageUnit ]; + after = [ persistentStorageUnit ]; before = [ "local-fs.target" ]; path = [ pkgs.util-linux ]; unitConfig.DefaultDependencies = false;