diff --git a/modules/fs/default.nix b/modules/fs/default.nix index dd2cbbdfb..200992978 100644 --- a/modules/fs/default.nix +++ b/modules/fs/default.nix @@ -22,7 +22,6 @@ let srcRoot = ./.; }; - mountNameFor = path: "${utils.escapeSystemdPath path}.mount"; serviceNameFor = path: "ensure-${utils.escapeSystemdPath path}"; # sane.fs."" top-level options @@ -53,21 +52,6 @@ let type = types.nullOr (mountEntryFor name); default = null; }; - wantedBy = mkOption { - type = types.listOf types.str; - default = []; - description = '' - list of units or targets which, when activated, should trigger this fs entry to be created. - ''; - }; - wantedBeforeBy = mkOption { - type = types.listOf types.str; - default = []; - description = '' - list of units or targets which, when activated, should first start and wait for this fs entry to be created. - if this unit fails, it will not block the targets in this list. - ''; - }; }; config = let default-acl = { @@ -245,9 +229,8 @@ let # prevent systemd making this unit implicitly dependent on sysinit.target. # see: unitConfig.DefaultDependencies = "no"; - - before = opt.wantedBeforeBy; - wantedBy = opt.wantedBy ++ opt.wantedBeforeBy; + # try to create all entries at boot, but don't block on them. blocking can be more targeted, by higher layers, via e.g. `RequiresMountsFor` + wantedBy = [ "default.target" ]; }; }; @@ -266,17 +249,16 @@ let device = ifBind opt.mount.bind; options = (lib.optionals isBind [ "bind" ]) ++ [ - # disable defaults: don't require this to be mount as part of local-fs.target - # we'll handle that stuff precisely. - "noauto" + # noauto: removes implicit `WantedBy=local-fs.target` + # nofail: removes implicit `Before=local-fs.target` + # because e.g. private data may not be available before local-fs + # "noauto" "nofail" # x-systemd options documented here: # - ] ++ (builtins.map (unit: "x-systemd.after=${unit}") requires) - ++ (builtins.map (unit: "x-systemd.requires=${unit}") requires) - ++ (builtins.map (unit: "x-systemd.before=${unit}") opt.wantedBeforeBy) - ++ (builtins.map (unit: "x-systemd.wanted-by=${unit}") (opt.wantedBy ++ opt.wantedBeforeBy)); + ++ (builtins.map (unit: "x-systemd.requires=${unit}") requires); noCheck = ifBind true; }; systemd.mounts = [{ @@ -286,8 +268,6 @@ let options = lib.concatStringsSep "," fsEntry.options; after = requires; requires = requires; - before = opt.wantedBeforeBy; - wantedBy = opt.wantedBeforeBy; inherit (opt.mount) mountConfig unitConfig; }]; }; diff --git a/modules/persist/default.nix b/modules/persist/default.nix index 97863c2f5..44963e790 100644 --- a/modules/persist/default.nix +++ b/modules/persist/default.nix @@ -46,21 +46,6 @@ let preferred way to link items from the store into the fs ''; }; - defaultOrdering.wantedBeforeBy = mkOption { - type = types.listOf types.str; - default = [ "local-fs.target" ]; - description = '' - list of units or targets which would prefer that everything in this store - be initialized before they run, but failing to do so should not error the items in this list. - ''; - }; - defaultOrdering.wantedBy = mkOption { - type = types.listOf types.str; - default = [ ]; - description = '' - list of units or targets which, upon activation, should activate all units in this store. - ''; - }; }; }; @@ -217,9 +202,7 @@ in in lib.mkMerge [ { # create destination dir, with correct perms - sane.fs."${fspath}" = { - inherit (store.defaultOrdering) wantedBy wantedBeforeBy; - } // (lib.optionalAttrs (method == "bind") { + sane.fs."${fspath}" = (lib.optionalAttrs (method == "bind") { # inherit perms & make sure we don't mount until after the mount point is setup correctly. dir.acl = opt.acl; mount.bind = fsPathToBackingPath fspath;