Inventory: simplify build-clan interface
This commit is contained in:
committed by
hsjobeki
parent
0d4928ab73
commit
9304afaa44
@@ -27,8 +27,50 @@ let
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
|
||||
# Each .nix file in the roles directory is a role
|
||||
# TODO: Helper function to set available roles within module meta.
|
||||
# roles = lib.pipe ./roles [
|
||||
# (p: if builtins.pathExists p then p else throw "Role directory does not exist")
|
||||
# builtins.readDir
|
||||
# (lib.filterAttrs (_n: v: v == "regular"))
|
||||
# lib.attrNames
|
||||
# (map (fileName: lib.removeSuffix ".nix" fileName))
|
||||
# ];
|
||||
|
||||
# TODO: make this an interface of every module
|
||||
# Maybe load from readme.md
|
||||
metaInfoOption = lib.mkOption {
|
||||
readOnly = true;
|
||||
default = {
|
||||
description = "A category for the service. This is used to group services in the clan ui";
|
||||
};
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
description = lib.mkOption {
|
||||
description = "A category for the service. This is used to group services in the clan ui";
|
||||
type = lib.types.str;
|
||||
};
|
||||
# icon = lib.mkOption {
|
||||
# description = "A category for the service. This is used to group services in the clan ui";
|
||||
# type = lib.types.str;
|
||||
# };
|
||||
# screenshots = lib.mkOption {
|
||||
# description = "A category for the service. This is used to group services in the clan ui";
|
||||
# type = lib.types.str;
|
||||
# };
|
||||
# category = lib.mkOption {
|
||||
# description = "A category for the service. This is used to group services in the clan ui";
|
||||
# type = lib.types.enum ["backup" "network"];
|
||||
# };
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
options.clan.borgbackup.meta = metaInfoOption;
|
||||
|
||||
options.clan.borgbackup.destinations = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule (
|
||||
@@ -63,6 +105,11 @@ in
|
||||
};
|
||||
|
||||
imports = [
|
||||
{
|
||||
config.clan.borgbackup.meta = {
|
||||
description = "backup";
|
||||
};
|
||||
}
|
||||
(lib.mkRemovedOptionModule [
|
||||
"clan"
|
||||
"borgbackup"
|
||||
@@ -76,7 +123,7 @@ in
|
||||
lib.nameValuePair "borgbackup-job-${dest.name}" {
|
||||
# since borgbackup mounts the system read-only, we need to run in a ExecStartPre script, so we can generate additional files.
|
||||
serviceConfig.ExecStartPre = [
|
||||
(''+${pkgs.writeShellScript "borgbackup-job-${dest.name}-pre-backup-commands" preBackupScript}'')
|
||||
''+${pkgs.writeShellScript "borgbackup-job-${dest.name}-pre-backup-commands" preBackupScript}''
|
||||
];
|
||||
}
|
||||
) cfg.destinations;
|
||||
|
||||
Reference in New Issue
Block a user