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:
Jared Baur
2024-04-05 12:44:25 -07:00
parent 754a00b38a
commit 43d8f47df3

View File

@@ -30,6 +30,10 @@ let
coreFileSystemOpts = { name, config, ... }: {
options = {
enable = mkEnableOption "the filesystem mount" // {
default = true;
};
mountPoint = mkOption {
example = "/mnt/usb";
type = nonEmptyWithoutTrailingSlash;
@@ -222,6 +226,7 @@ in
}
'';
type = types.attrsOf (types.submodule [coreFileSystemOpts fileSystemOpts]);
apply = lib.filterAttrs (_: fs: fs.enable);
description = ''
The file systems to be mounted. It must include an entry for
the root directory (`mountPoint = "/"`). Each
@@ -268,6 +273,7 @@ in
boot.specialFileSystems = mkOption {
default = {};
type = types.attrsOf (types.submodule coreFileSystemOpts);
apply = lib.filterAttrs (_: fs: fs.enable);
internal = true;
description = ''
Special filesystems that are mounted very early during boot.