From e748f79a90e44e309e092a3adad2f1ccdc3490d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Thu, 4 Jun 2020 17:51:26 +0100 Subject: [PATCH] move backups config to a separate file --- nixos/backups.nix | 24 ++++++++++++++++++++++++ nixos/boxes/foureighty/configuration.nix | 1 + nixos/common-services.nix | 18 ------------------ 3 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 nixos/backups.nix diff --git a/nixos/backups.nix b/nixos/backups.nix new file mode 100644 index 00000000..8407ccf8 --- /dev/null +++ b/nixos/backups.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: +{ + + services = { + restic.backups.home-to-brix = { + passwordFile = "/etc/nixos/secrets/restic-password-brix"; + paths = [ "/home" ]; + repository = "rest:http://brix.local:8000/"; + timerConfig = { OnCalendar = "hourly"; }; + extraBackupArgs = [ "--exclude='.cache'" "--exclude='.rustup'" ]; + pruneOpts = [ "--keep-hourly 25" "--keep-daily 8" "--keep-weekly 5" "--keep-monthly 13" "--keep-yearly 16" ]; + }; + + restic.backups.home-to-b2 = { + passwordFile = "/etc/nixos/secrets/restic-password-b2"; + paths = [ "/home" ]; + repository = "b2:cyplo-restic-foureighty:/"; + timerConfig = { OnCalendar = "hourly"; }; + extraBackupArgs = [ "--exclude='.cache'" "--exclude='.rustup'" ]; + pruneOpts = [ "--keep-daily 8" "--keep-weekly 5" "--keep-monthly 13" "--keep-yearly 16" ]; + s3CredentialsFile = "/etc/nixos/secrets/b2"; + }; + }; +} diff --git a/nixos/boxes/foureighty/configuration.nix b/nixos/boxes/foureighty/configuration.nix index cf2605eb..e55bd3c1 100644 --- a/nixos/boxes/foureighty/configuration.nix +++ b/nixos/boxes/foureighty/configuration.nix @@ -38,6 +38,7 @@ ../../distributed-builds.nix ../../libvirt.nix ../../i3/system.nix + ../../backups.nix ]; diff --git a/nixos/common-services.nix b/nixos/common-services.nix index 39696d89..3730007a 100644 --- a/nixos/common-services.nix +++ b/nixos/common-services.nix @@ -31,24 +31,6 @@ nssmdns = true; }; - restic.backups.home-to-brix = { - passwordFile = "/etc/nixos/secrets/restic-password-brix"; - paths = [ "/home" ]; - repository = "rest:http://brix.local:8000/"; - timerConfig = { OnCalendar = "hourly"; }; - extraBackupArgs = [ "--exclude='.cache'" "--exclude='.rustup'" ]; - pruneOpts = [ "--keep-hourly 25" "--keep-daily 8" "--keep-weekly 5" "--keep-monthly 13" "--keep-yearly 16" ]; - }; - - restic.backups.home-to-b2 = { - passwordFile = "/etc/nixos/secrets/restic-password-b2"; - paths = [ "/home" ]; - repository = "b2:cyplo-restic-foureighty:/"; - timerConfig = { OnCalendar = "hourly"; }; - extraBackupArgs = [ "--exclude='.cache'" "--exclude='.rustup'" ]; - pruneOpts = [ "--keep-daily 8" "--keep-weekly 5" "--keep-monthly 13" "--keep-yearly 16" ]; - s3CredentialsFile = "/etc/nixos/secrets/b2"; - }; geoclue2.enable = true; xserver = {