sane.fs: make bind
a required sub-option of mount
This commit is contained in:
@@ -135,7 +135,7 @@ let
|
|||||||
mountEntryFor = path: types.submodule {
|
mountEntryFor = path: types.submodule {
|
||||||
options = {
|
options = {
|
||||||
bind = mkOption {
|
bind = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.str;
|
||||||
description = "fs path to bind-mount from";
|
description = "fs path to bind-mount from";
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
@@ -159,13 +159,11 @@ let
|
|||||||
# given a mountEntry definition, evaluate its toplevel `config` output.
|
# given a mountEntry definition, evaluate its toplevel `config` output.
|
||||||
mkMountConfig = path: opt: let
|
mkMountConfig = path: opt: let
|
||||||
fsEntry = config.fileSystems."${path}";
|
fsEntry = config.fileSystems."${path}";
|
||||||
isBind = opt.mount.bind != null;
|
|
||||||
ifBind = lib.mkIf isBind;
|
|
||||||
in {
|
in {
|
||||||
fileSystems."${path}" = {
|
fileSystems."${path}" = {
|
||||||
device = ifBind opt.mount.bind;
|
device = opt.mount.bind;
|
||||||
options = (lib.optionals isBind [ "bind" ])
|
options = [
|
||||||
++ [
|
"bind"
|
||||||
# noauto: removes implicit `WantedBy=local-fs.target`
|
# noauto: removes implicit `WantedBy=local-fs.target`
|
||||||
# nofail: removes implicit `Before=local-fs.target`
|
# nofail: removes implicit `Before=local-fs.target`
|
||||||
# because e.g. private data may not be available before local-fs
|
# because e.g. private data may not be available before local-fs
|
||||||
@@ -174,7 +172,7 @@ let
|
|||||||
# x-systemd options documented here:
|
# x-systemd options documented here:
|
||||||
# - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
|
# - <https://www.freedesktop.org/software/systemd/man/systemd.mount.html>
|
||||||
];
|
];
|
||||||
noCheck = ifBind true;
|
noCheck = true;
|
||||||
};
|
};
|
||||||
systemd.mounts = [{
|
systemd.mounts = [{
|
||||||
where = path;
|
where = path;
|
||||||
|
Reference in New Issue
Block a user