refactor: moved nixos modules to dendrite pattern
This commit is contained in:
parent
df8dd110ad
commit
0ea11e0236
219 changed files with 4802 additions and 4820 deletions
60
modules/nixos/storage/impermanence-dataset.nix
Normal file
60
modules/nixos/storage/impermanence-dataset.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{config, ...}: let
|
||||
datasetSubmodule = config.flake.commonModules.storage-dataset-submodule;
|
||||
submodule = args @ {lib, ...}: {name, ...}: let
|
||||
pathPermissions = {
|
||||
read = lib.mkEnableOption "should the path have read permissions";
|
||||
write = lib.mkEnableOption "should the path have read permissions";
|
||||
execute = lib.mkEnableOption "should the path have read permissions";
|
||||
};
|
||||
pathTypeSubmodule = {name, ...}: {
|
||||
options = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
owner = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "root";
|
||||
};
|
||||
permissions = pathPermissions;
|
||||
};
|
||||
group = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "root";
|
||||
};
|
||||
permissions = pathPermissions;
|
||||
};
|
||||
other = {
|
||||
permissions = pathPermissions;
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
imports = [
|
||||
(datasetSubmodule args)
|
||||
];
|
||||
|
||||
options = {
|
||||
files = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule pathTypeSubmodule);
|
||||
default = {};
|
||||
};
|
||||
directories = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule pathTypeSubmodule);
|
||||
default = {};
|
||||
};
|
||||
impermanence.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
mount = lib.mkDefault "/${name}";
|
||||
};
|
||||
};
|
||||
in {
|
||||
flake.commonModules.storage-impermanence-dataset-submodule = submodule;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue