From ca85dac4acd8f21c4fb55c0ca1761697ced5f5f3 Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 30 Sep 2024 10:09:29 +0000 Subject: [PATCH] sane.fs: make `bind` a required sub-option of `mount` --- modules/fs/default.nix | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/modules/fs/default.nix b/modules/fs/default.nix index deb7334c5..e712dd51f 100644 --- a/modules/fs/default.nix +++ b/modules/fs/default.nix @@ -135,7 +135,7 @@ let mountEntryFor = path: types.submodule { options = { bind = mkOption { - type = types.nullOr types.str; + type = types.str; description = "fs path to bind-mount from"; default = null; }; @@ -159,22 +159,20 @@ let # given a mountEntry definition, evaluate its toplevel `config` output. mkMountConfig = path: opt: let fsEntry = config.fileSystems."${path}"; - isBind = opt.mount.bind != null; - ifBind = lib.mkIf isBind; in { fileSystems."${path}" = { - device = ifBind opt.mount.bind; - options = (lib.optionals isBind [ "bind" ]) - ++ [ - # 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: - # - - ]; - noCheck = ifBind true; + device = opt.mount.bind; + options = [ + "bind" + # 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: + # - + ]; + noCheck = true; }; systemd.mounts = [{ where = path;