From ce64d9bbb27e2b268cb5d16f4960c7ce8fd385d1 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 12 May 2023 11:37:57 -0700 Subject: hosts: move around backup configuration --- hosts/aptos/default.nix | 32 +++++++++++++++++++++++++++++--- hosts/aptos/services.nix | 32 -------------------------------- hosts/tahoe/default.nix | 19 +++++++++++++++++++ hosts/tahoe/services.nix | 16 +--------------- 4 files changed, 49 insertions(+), 50 deletions(-) delete mode 100644 hosts/aptos/services.nix diff --git a/hosts/aptos/default.nix b/hosts/aptos/default.nix index 6326615..b2236f5 100644 --- a/hosts/aptos/default.nix +++ b/hosts/aptos/default.nix @@ -1,10 +1,12 @@ -{ self, ... }: - +{ self, config, ... }: +let + secrets = config.age.secrets; + ssh-key-path = secrets."restic/ssh-key".path; +in { imports = [ ./hardware.nix ./networking.nix - ./services.nix "${self}/profiles/btrfs.nix" "${self}/profiles/documentation.nix" "${self}/profiles/laptop.nix" @@ -12,6 +14,30 @@ "${self}/profiles/hardware/xps9300.nix" ]; + my.services.backup = { + enable = true; + repository = "sftp:192.168.6.40:/${config.networking.hostName}"; + exclude = [ + # paths that I don't want to backup + "/home/fcuny/workspace/tmp" + + # various development related files + "**/target" + "**/.direnv" + "**/result" + ]; + timerConfig = { OnCalendar = "06:30"; }; + passwordFile = secrets."restic/repo-users".path; + extraOptions = [ + "sftp.command='ssh backup@192.168.6.40 -i ${ssh-key-path} -s sftp'" + ]; + paths = [ + "/home/fcuny/workspace" + "/home/fcuny/media" + "/home/fcuny/documents" + ]; + }; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/hosts/aptos/services.nix b/hosts/aptos/services.nix deleted file mode 100644 index 742b014..0000000 --- a/hosts/aptos/services.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config, ... }: -let - secrets = config.age.secrets; - ssh-key-path = secrets."restic/ssh-key".path; -in -{ - my.services = { - backup = { - enable = true; - repository = "sftp:192.168.6.40:/aptos"; - exclude = [ - # paths that I don't want to backup - "/home/fcuny/workspace/tmp" - - # various development related files - "**/target" - "**/.direnv" - "**/result" - ]; - timerConfig = { OnCalendar = "06:30"; }; - passwordFile = secrets."restic/repo-users".path; - extraOptions = [ - "sftp.command='ssh backup@192.168.6.40 -i ${ssh-key-path} -s sftp'" - ]; - paths = [ - "/home/fcuny/workspace" - "/home/fcuny/media" - "/home/fcuny/documents" - ]; - }; - }; -} diff --git a/hosts/tahoe/default.nix b/hosts/tahoe/default.nix index ae4bef8..ade4b5b 100644 --- a/hosts/tahoe/default.nix +++ b/hosts/tahoe/default.nix @@ -1,4 +1,7 @@ { config, pkgs, hostname, self, ... }: +let + secrets = config.age.secrets; +in { imports = [ ./boot.nix @@ -17,6 +20,22 @@ "${self}/profiles/hardware/amd.nix" ]; + my.services.backup = { + enable = true; + repository = "/data/slow/backups/hosts/${config.networking.hostName}"; + timerConfig = { OnCalendar = "00:15"; }; + passwordFile = secrets."restic/repo-systems".path; + paths = + [ + "/data/fast/music" + "/data/fast/photos" + "/home/fcuny/documents" + "/home/fcuny/workspace" + "/home/fcuny/media" + ]; + exclude = [ ]; + }; + # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave diff --git a/hosts/tahoe/services.nix b/hosts/tahoe/services.nix index 4b29870..4056df3 100644 --- a/hosts/tahoe/services.nix +++ b/hosts/tahoe/services.nix @@ -23,21 +23,7 @@ in promtail.enable = true; node-exporter.enable = true; }; - backup = { - enable = true; - repository = "/data/slow/backups/hosts/tahoe"; - timerConfig = { OnCalendar = "00:15"; }; - passwordFile = secrets."restic/repo-systems".path; - paths = - [ - "/data/fast/music" - "/data/fast/photos" - "/home/fcuny/documents" - "/home/fcuny/workspace" - "/home/fcuny/media" - ]; - exclude = [ ]; - }; + sendsms.enable = true; }; } -- cgit 1.4.1