refactor: moved modules to legacy-modules
This commit is contained in:
parent
d646b954ac
commit
db7ac35613
233 changed files with 5 additions and 5 deletions
86
legacy-modules/nixos-modules/storage/submodules/dataset.nix
Normal file
86
legacy-modules/nixos-modules/storage/submodules/dataset.nix
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
{lib, ...}: {name, ...}: {
|
||||
options = {
|
||||
type = lib.mkOption {
|
||||
type = lib.types.enum ["zfs_fs" "zfs_volume"];
|
||||
default = "zfs_fs";
|
||||
description = "Type of ZFS dataset (filesystem or volume)";
|
||||
};
|
||||
|
||||
acltype = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum ["off" "nfsv4" "posixacl"]);
|
||||
default = null;
|
||||
description = "Access control list type";
|
||||
};
|
||||
|
||||
relatime = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum ["on" "off"]);
|
||||
default = null;
|
||||
description = "Controls when access time is updated";
|
||||
};
|
||||
|
||||
atime = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum ["on" "off"]);
|
||||
default = null;
|
||||
description = "Controls whether access time is updated";
|
||||
};
|
||||
|
||||
xattr = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum ["on" "off" "sa" "dir"]);
|
||||
default = null;
|
||||
description = "Extended attribute storage method";
|
||||
};
|
||||
|
||||
compression = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum ["on" "off" "lz4" "gzip" "zstd" "lzjb" "zle"]);
|
||||
default = null;
|
||||
description = "Compression algorithm to use";
|
||||
};
|
||||
|
||||
sync = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum ["standard" "always" "disabled"]);
|
||||
default = null;
|
||||
description = "Synchronous write behavior";
|
||||
};
|
||||
|
||||
mount = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
description = "Controls the mount point used for this file system";
|
||||
default = null;
|
||||
};
|
||||
|
||||
encryption = {
|
||||
enable = lib.mkEnableOption "should encryption be enabled";
|
||||
type = lib.mkOption {
|
||||
type = lib.types.enum ["aes-128-ccm" "aes-192-ccm" "aes-256-ccm" "aes-128-gcm" "aes-192-gcm" "aes-256-gcm"];
|
||||
description = "What encryption type to use";
|
||||
};
|
||||
keyformat = lib.mkOption {
|
||||
type = lib.types.enum ["raw" "hex" "passphrase"];
|
||||
description = "Format of the encryption key";
|
||||
};
|
||||
keylocation = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Location of the encryption key";
|
||||
};
|
||||
};
|
||||
|
||||
snapshot = {
|
||||
# This option should set this option flag
|
||||
autoSnapshot = lib.mkEnableOption "Enable automatic snapshots for this dataset";
|
||||
# Creates a blank snapshot in the post create hook for rollback purposes
|
||||
blankSnapshot = lib.mkEnableOption "Should a blank snapshot be auto created in the post create hook";
|
||||
};
|
||||
|
||||
recordSize = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Suggested block size for files in the file system";
|
||||
};
|
||||
|
||||
postCreateHook = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Script to run after dataset creation";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
args @ {lib, ...}: {name, ...}: let
|
||||
datasetSubmodule = (import ./dataset.nix) args;
|
||||
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
|
||||
];
|
||||
|
||||
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}";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue