organized into folders
This commit is contained in:
parent
8a8fe8cfc6
commit
84c5dd7422
7 changed files with 5 additions and 9 deletions
120
lib/configuration-type.nix
Normal file
120
lib/configuration-type.nix
Normal file
|
@ -0,0 +1,120 @@
|
|||
{lib, ...}: let
|
||||
folderType = lib.types.submodule ({name, ...}: {
|
||||
options = {
|
||||
id = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
};
|
||||
label = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = name;
|
||||
};
|
||||
};
|
||||
});
|
||||
in {
|
||||
folders = lib.mkOption {
|
||||
type = lib.types.attrsOf folderType;
|
||||
default = {};
|
||||
};
|
||||
devices = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule ({name, ...}: {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = name;
|
||||
};
|
||||
id = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
};
|
||||
folders = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule (
|
||||
{config, ...}: {
|
||||
options = {
|
||||
folder = lib.mkOption {
|
||||
type = folderType;
|
||||
};
|
||||
path = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
};
|
||||
type = lib.mkOption {
|
||||
type = lib.types.enum ["sendreceive" "sendonly" "receiveonly" "receiveencrypted"];
|
||||
default = "sendreceive";
|
||||
};
|
||||
versioning = {
|
||||
simple = {
|
||||
enable = lib.mkEnableOption "should this folder use simple versioning";
|
||||
keep = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = "10";
|
||||
};
|
||||
};
|
||||
trashcan = {
|
||||
enable = lib.mkEnableOption "should this folder use trashcan versioning";
|
||||
cleanoutDays = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = "1000";
|
||||
};
|
||||
};
|
||||
staggered = {
|
||||
enable = lib.mkEnableOption "should this folder use staggard versioning";
|
||||
cleanInterval = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = "3600";
|
||||
};
|
||||
maxAge = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
default = "31536000";
|
||||
};
|
||||
};
|
||||
external = {
|
||||
enable = lib.mkEnableOption "should this folder use external versioning";
|
||||
};
|
||||
};
|
||||
};
|
||||
# TODO: figure out how to make assertions for submodules
|
||||
# config = {
|
||||
# assertions =
|
||||
# (lib.lists.optionals config.versioning.simple.enable [
|
||||
# {
|
||||
# assertion = !config.versioning.trashcan.enable;
|
||||
# message = "Can not use both simple and trashcan versioning at the same time.";
|
||||
# }
|
||||
# {
|
||||
# assertion = !config.versioning.staggered.enable;
|
||||
# message = "Can not use both simple and staggered versioning at the same time.";
|
||||
# }
|
||||
# {
|
||||
# assertion = !config.versioning.external.enable;
|
||||
# message = "Can not use both simple and external versioning at the same time.";
|
||||
# }
|
||||
# ])
|
||||
# ++ (lib.lists.optionals config.versioning.trashcan.enable [
|
||||
# {
|
||||
# assertion = !config.versioning.staggered.enable;
|
||||
# message = "Can not use both trashcan and staggered versioning at the same time.";
|
||||
# }
|
||||
# {
|
||||
# assertion = !config.versioning.external.enable;
|
||||
# message = "Can not use both trashcan and external versioning at the same time.";
|
||||
# }
|
||||
# ])
|
||||
# ++ (lib.lists.optionals config.versioning.staggered.enable [
|
||||
# {
|
||||
# assertion = !config.versioning.external.enable;
|
||||
# message = "Can not use both staggered and external versioning at the same time.";
|
||||
# }
|
||||
# ])
|
||||
# ++ [
|
||||
# {
|
||||
# assertion = !config.versioning.external.enable;
|
||||
# message = "External versioning currently not implemented.";
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
}
|
||||
));
|
||||
};
|
||||
};
|
||||
}));
|
||||
default = {};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue