Add the ability ignore messages for servers that have no state to backup that are production.

This commit is contained in:
Joseph Hanson 2024-07-27 16:27:50 -05:00
parent 218d68e1c1
commit 81312eed0f
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
3 changed files with 18 additions and 2 deletions

View file

@ -84,6 +84,8 @@ in
samba.extraConfig = import ./config/samba-config.nix { };
resticBackup.local.enable = false;
resticBackup.remote.enable = false;
resticBackup.local.noWarning = true;
resticBackup.remote.noWarning = true;
# Borg
borgbackup = {
enable = true;

View file

@ -68,6 +68,8 @@
system.motd.networkInterfaces = [ "enp2s0" "wlp3s0" ];
system.resticBackup.local.enable = false;
system.resticBackup.remote.enable = false;
system.resticBackup.local.noWarning = true;
system.resticBackup.remote.noWarning = true;
services = {
podman.enable = true;

View file

@ -7,6 +7,12 @@ in
options.mySystem.system.resticBackup = {
local = {
enable = mkEnableOption "Local backups" // { default = true; };
noWarning = mkOption
{
type = types.bool;
description = "Disable warning for local backups";
default = false;
};
location = mkOption
{
type = types.str;
@ -16,6 +22,12 @@ in
};
remote = {
enable = mkEnableOption "Remote backups" // { default = true; };
noWarning = mkOption
{
type = types.bool;
description = "Disable warning for remote backups";
default = false;
};
location = mkOption
{
type = types.str;
@ -34,8 +46,8 @@ in
# Warn if backups are disable and machine isnt a dev box
warnings = [
(mkIf (!cfg.local.enable && config.mySystem.purpose != "Development") "WARNING: Local backups are disabled for ${config.system.name}!")
(mkIf (!cfg.remote.enable && config.mySystem.purpose != "Development") "WARNING: Remote backups are disabled for ${config.system.name}!")
(mkIf (!cfg.local.noWarning && !cfg.local.enable && config.mySystem.purpose != "Development") "WARNING: Local backups are disabled for ${config.system.name}!")
(mkIf (!cfg.remote.noWarning && !cfg.remote.enable && config.mySystem.purpose != "Development") "WARNING: Remote backups are disabled for ${config.system.name}!")
];
sops.secrets = mkIf (cfg.local.enable || cfg.remote.enable) {