From 224f1c35625541248fff3854c8598755e6050839 Mon Sep 17 00:00:00 2001 From: Kopatz <7265381+Kropatz@users.noreply.github.com> Date: Thu, 26 Oct 2023 15:17:00 +0200 Subject: [PATCH] add backup --- test-server/configuration.nix | 2 ++ test-server/flake.nix | 1 + test-server/hardware-configuration.nix | 5 +++++ test-server/modules/backup.nix | 21 +++++++++++++++++++++ test-server/secrets/restic-pw.age | Bin 0 -> 287 bytes test-server/secrets/secrets.nix | 1 + 6 files changed, 30 insertions(+) create mode 100644 test-server/modules/backup.nix create mode 100644 test-server/secrets/restic-pw.age diff --git a/test-server/configuration.nix b/test-server/configuration.nix index 5aba0ac..6112da8 100644 --- a/test-server/configuration.nix +++ b/test-server/configuration.nix @@ -110,6 +110,8 @@ in{ inputs.agenix.packages."x86_64-linux".default btop shash + gparted + restic # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. # wget ]; diff --git a/test-server/flake.nix b/test-server/flake.nix index 2b631a1..9b175f4 100644 --- a/test-server/flake.nix +++ b/test-server/flake.nix @@ -18,6 +18,7 @@ ./modules/nextcloud.nix ./modules/acme.nix ./modules/samba.nix + ./modules/backup.nix #./modules/dyndns.nix i think ddclient is deprecated #./modules/home-assistant.nix idk dont like this agenix.nixosModules.default diff --git a/test-server/hardware-configuration.nix b/test-server/hardware-configuration.nix index b6ef8dc..9989c40 100644 --- a/test-server/hardware-configuration.nix +++ b/test-server/hardware-configuration.nix @@ -16,6 +16,11 @@ fsType = "ext4"; }; + fileSystems."/mnt/backup" = + { + device = "/dev/disk/by-uuid/8c49cdd0-78a0-45cc-93f1-4287524d20c3"; + fsType = "ext4"; + }; swapDevices = [ ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking diff --git a/test-server/modules/backup.nix b/test-server/modules/backup.nix new file mode 100644 index 0000000..36a9675 --- /dev/null +++ b/test-server/modules/backup.nix @@ -0,0 +1,21 @@ +{ config, pkgs, lib, inputs, ... }: +{ + age.secrets.restic-pw = { + file = ../secrets/restic-pw.age; + }; + services.restic = { + backups = { + localbackup = { + exclude = [ + "/home/*/.cache" + ]; + initialize = true; + passwordFile = config.age.secrets.restic-pw.path; + paths = [ + "/home" + ]; + repository = "/mnt/backup"; + }; + }; + }; +} \ No newline at end of file diff --git a/test-server/secrets/restic-pw.age b/test-server/secrets/restic-pw.age new file mode 100644 index 0000000000000000000000000000000000000000..606643a0c90464c8d53916637c000cd233034dda GIT binary patch literal 287 zcmYdHPt{G$OD?J`D9Oyv)5|YP*Do{V(zR14F3!+RO))YxHMCTyOmlYjEmtVY&(5jL z@bN6G(vHl{(XMc7Sky;h7O!rEQqwpB)t*nB?wZkR9RXl+AV6 z?6>#i>f28l7|U0->16e~NS8kRcD}Sk(Z2iR+OvHcGcI2UewDQ6P5k;P9wKQg`RA^B lzC1-LAKcWxh9ThY~8I_002_&Zl(YL literal 0 HcmV?d00001 diff --git a/test-server/secrets/secrets.nix b/test-server/secrets/secrets.nix index be6cb3c..b610585 100644 --- a/test-server/secrets/secrets.nix +++ b/test-server/secrets/secrets.nix @@ -7,4 +7,5 @@ in "github-runner-pw.age".publicKeys = [ nix-test-vm ]; "duckdns.age".publicKeys = [ nix-test-vm ]; "nextcloud-admin.age".publicKeys = [ nix-test-vm ]; + "restic-pw.age".publicKeys = [ nix-test-vm ]; } \ No newline at end of file