clan-core/nixosModules/clanCore/state.nix

73 lines
2.2 KiB
Nix
Raw Normal View History

{ lib, ... }:
{
# defaults
2024-06-17 10:42:28 +00:00
config.clan.core.state.HOME.folders = [ "/home" ];
# interface
2024-06-17 10:42:28 +00:00
options.clan.core.state = lib.mkOption {
default = { };
2024-03-17 18:48:49 +00:00
type = lib.types.attrsOf (
lib.types.submodule (
2024-06-05 16:37:31 +00:00
{ name, ... }:
2024-03-17 18:48:49 +00:00
{
options = {
2024-06-05 16:37:31 +00:00
name = lib.mkOption {
type = lib.types.str;
default = name;
description = ''
Name of the state
'';
};
2024-03-17 18:48:49 +00:00
folders = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = ''
Folder where state resides in
'';
};
2024-05-31 14:36:37 +00:00
preBackupCommand = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = ''
script to run before backing up the state dir
This is for example useful for services that require an export of their state
e.g. a database dump
'';
};
# TODO: implement this
#stopOnRestore = lib.mkOption {
# type = lib.types.listOf lib.types.str;
# default = [];
# description = ''
# List of services to stop before restoring the state dir from a backup
# Utilize this to stop services which currently access these folders or or other services affected by the restore
# '';
#};
preRestoreCommand = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
2024-03-17 18:48:49 +00:00
description = ''
script to run before restoring the state dir from a backup
2024-01-15 09:03:47 +00:00
2024-03-17 18:48:49 +00:00
Utilize this to stop services which currently access these folders
'';
};
postRestoreCommand = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
2024-03-17 18:48:49 +00:00
description = ''
script to restore the service after the state dir was restored from a backup
2024-01-15 09:03:47 +00:00
2024-03-17 18:48:49 +00:00
Utilize this to start services which were previously stopped
'';
};
};
2024-03-17 18:48:49 +00:00
}
)
);
};
}