sane.fs: make bind
a required sub-option of mount
This commit is contained in:
@@ -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:
|
||||
# - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
|
||||
];
|
||||
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:
|
||||
# - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
|
||||
];
|
||||
noCheck = true;
|
||||
};
|
||||
systemd.mounts = [{
|
||||
where = path;
|
||||
|
Reference in New Issue
Block a user