diff --git a/modules/users/overseer/backups.nix b/modules/users/overseer/backups.nix new file mode 100644 index 0000000..1a60a5e --- /dev/null +++ b/modules/users/overseer/backups.nix @@ -0,0 +1,33 @@ +let + volumePath = "/overseer/services"; +in + { + lib, + config, + ... + }: + lib.mkIf config.user.overseer.enable { + services.restic.backups.borg-base = { + user = "root"; + timerConfig = { + OnCalendar = "hourly"; + Persistent = true; + }; + paths = [ + # bar-assistant.nix + "${volumePath}/bar-assistant" + "${volumePath}/meilisearch" + + # homebox.nix + "/var/lib/homebox/data" + + # lubelogger.nix + "${volumePath}/lubelogger" + + # trilium.nix + "/var/lib/trilium/backup" + ]; + repositoryFile = config.sops.secrets."restic/url".path; + passwordFile = config.sops.secrets."restic/key".path; + }; + } diff --git a/modules/users/overseer/default.nix b/modules/users/overseer/default.nix index faa4cdd..d8bbe7a 100644 --- a/modules/users/overseer/default.nix +++ b/modules/users/overseer/default.nix @@ -4,6 +4,7 @@ ./setup.nix ./secrets.nix ./acme.nix + ./backups.nix ./services ]; } diff --git a/modules/users/overseer/services/bar-assistant.nix b/modules/users/overseer/services/bar-assistant.nix index 9acbc23..d699bd6 100644 --- a/modules/users/overseer/services/bar-assistant.nix +++ b/modules/users/overseer/services/bar-assistant.nix @@ -63,23 +63,6 @@ in }; }; - ########## - # Backup # - ########## - services.restic.backups.bar-assistant = { - user = "root"; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - }; - paths = [ - "${volumePath}/bar-assistant" - "${volumePath}/meilisearch" - ]; - repositoryFile = config.sops.secrets."restic/url".path; - passwordFile = config.sops.secrets."restic/key".path; - }; - ########### # Service # ########### diff --git a/modules/users/overseer/services/bookstack.nix b/modules/users/overseer/services/bookstack.nix deleted file mode 100644 index bd7ae6d..0000000 --- a/modules/users/overseer/services/bookstack.nix +++ /dev/null @@ -1,47 +0,0 @@ -let - volumePath = "/overseer/services"; -in - { - lib, - pkgs, - config, - ... - }: - lib.mkIf config.user.overseer.enable { - sops.secrets."bookstack/key" = { - owner = "bookstack"; - }; - - services.restic.backups.bookstack = { - user = "root"; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - }; - backupPrepareCommand = "${pkgs.mariadb}/bin/mysqldump -u root bookstack > ${volumePath}/tmp/bookstack.sql"; - backupCleanupCommand = "rm ${volumePath}/tmp/bookstack.sql"; - paths = [ - "/var/lib/bookstack" - "${volumePath}/tmp/bookstack.sql" - ]; - repositoryFile = config.sops.secrets."restic/url".path; - passwordFile = config.sops.secrets."restic/key".path; - }; - - services.bookstack = { - enable = true; - hostname = "bookstack.wanderingcrow.net"; - database.createLocally = true; - appKeyFile = config.sops.secrets."bookstack/key".path; - nginx = { - forceSSL = true; - extraConfig = '' - allow 192.168.0.0/16; - allow 10.8.0.0/24; - allow 24.179.20.202; - deny all; - ''; - useACMEHost = "bookstack.wanderingcrow.net"; - }; - }; - } diff --git a/modules/users/overseer/services/homebox.nix b/modules/users/overseer/services/homebox.nix index 8d3b112..c32016a 100644 --- a/modules/users/overseer/services/homebox.nix +++ b/modules/users/overseer/services/homebox.nix @@ -5,19 +5,6 @@ }: lib.mkIf config.user.overseer.enable { services = { - restic.backups.homebox = { - user = "root"; - timerConfig = { - OnCalendar = "hourly"; - Persistent = true; - }; - paths = [ - "/var/lib/homebox/data" - ]; - repositoryFile = config.sops.secrets."restic/url".path; - passwordFile = config.sops.secrets."restic/key".path; - }; - nginx = { enable = true; recommendedProxySettings = true; diff --git a/modules/users/overseer/services/lubelogger.nix b/modules/users/overseer/services/lubelogger.nix index e3ca3c3..41d83f0 100644 --- a/modules/users/overseer/services/lubelogger.nix +++ b/modules/users/overseer/services/lubelogger.nix @@ -16,19 +16,6 @@ in # Service # ########### - services.restic.backups.bar-assistant = { - user = "root"; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - }; - paths = [ - "${volumePath}/lubelogger" - ]; - repositoryFile = config.sops.secrets."restic/url".path; - passwordFile = config.sops.secrets."restic/key".path; - }; - sops = { secrets = { "lubelogger/user_hash" = {}; diff --git a/modules/users/overseer/services/trilium.nix b/modules/users/overseer/services/trilium.nix index 586afc9..71a6bd4 100644 --- a/modules/users/overseer/services/trilium.nix +++ b/modules/users/overseer/services/trilium.nix @@ -6,19 +6,6 @@ }: lib.mkIf config.user.overseer.enable { services = { - restic.backups.notes = { - user = "root"; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - }; - paths = [ - "/var/lib/trilium/backup" - ]; - repositoryFile = config.sops.secrets."restic/url".path; - passwordFile = config.sops.secrets."restic/key".path; - }; - trilium-server = { enable = true; package = pkgs.trilium-next-server;