diff --git a/hosts/nixos/Dragneel/backups.nix b/hosts/nixos/Dragneel/backups.nix new file mode 100644 index 0000000..54c752e --- /dev/null +++ b/hosts/nixos/Dragneel/backups.nix @@ -0,0 +1,39 @@ +{ + config, + ... +}: +{ + # Restic secrets + sops.secrets = { + "restic/hetzner-dragneel/url" = { }; + "restic/hetzner-dragneel/key" = { }; + }; + + services.restic.backups = { + hetzner-dragneel = { + initialize = true; + user = "root"; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + }; + extraOptions = [ + "sftp.args='-i /etc/ssh/ssh_host_ed25519_key -p 23'" + ]; + repositoryFile = config.sops.secrets."restic/hetzner-handlerone/url".path; + passwordFile = config.sops.secrets."restic/hetzner-handlerone/key".path; + paths = [ + "/home/dragneel" + ]; + exclude = [ + "/var/cache" + "/home/*/.cache" + ".git" + ".nix-profile" + "/nix/*" + ".local/share/Steam" + ".steam" + ]; + }; + }; +} diff --git a/hosts/nixos/Dragneel/default.nix b/hosts/nixos/Dragneel/default.nix index 701596f..62deb11 100644 --- a/hosts/nixos/Dragneel/default.nix +++ b/hosts/nixos/Dragneel/default.nix @@ -9,10 +9,12 @@ lib, pkgs, ... -}: { +}: +{ imports = lib.flatten [ # Hardware ./hardware-configuration.nix # I want to use factor if possible + ./backups.nix # Disks inputs.disko.nixosModules.disko