nixos/fileSystems: add enable option
Add the ability to disable filesystems set in a nixos config (enabled by default). This makes the submodules under `fileSystems` behave more like submodules in other nixos modules.
This commit is contained in:
@@ -30,6 +30,10 @@ let
|
|||||||
coreFileSystemOpts = { name, config, ... }: {
|
coreFileSystemOpts = { name, config, ... }: {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
enable = mkEnableOption "the filesystem mount" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
mountPoint = mkOption {
|
mountPoint = mkOption {
|
||||||
example = "/mnt/usb";
|
example = "/mnt/usb";
|
||||||
type = nonEmptyWithoutTrailingSlash;
|
type = nonEmptyWithoutTrailingSlash;
|
||||||
@@ -222,6 +226,7 @@ in
|
|||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
type = types.attrsOf (types.submodule [coreFileSystemOpts fileSystemOpts]);
|
type = types.attrsOf (types.submodule [coreFileSystemOpts fileSystemOpts]);
|
||||||
|
apply = lib.filterAttrs (_: fs: fs.enable);
|
||||||
description = ''
|
description = ''
|
||||||
The file systems to be mounted. It must include an entry for
|
The file systems to be mounted. It must include an entry for
|
||||||
the root directory (`mountPoint = "/"`). Each
|
the root directory (`mountPoint = "/"`). Each
|
||||||
@@ -268,6 +273,7 @@ in
|
|||||||
boot.specialFileSystems = mkOption {
|
boot.specialFileSystems = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = types.attrsOf (types.submodule coreFileSystemOpts);
|
type = types.attrsOf (types.submodule coreFileSystemOpts);
|
||||||
|
apply = lib.filterAttrs (_: fs: fs.enable);
|
||||||
internal = true;
|
internal = true;
|
||||||
description = ''
|
description = ''
|
||||||
Special filesystems that are mounted very early during boot.
|
Special filesystems that are mounted very early during boot.
|
||||||
|
|||||||
Reference in New Issue
Block a user