From 2a8a72b7cb61e2605582869db48b97d97c24e9f0 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Sun, 16 Aug 2026 14:02:33 +0200 Subject: [PATCH] backwards/manatee: Move `restic` backup to `mantee` --- hosts/backwards/modules/default.nix | 1 - hosts/backwards/modules/restic/default.nix | 74 ------------------ hosts/manatee/modules/default.nix | 1 + hosts/manatee/modules/restic/default.nix | 56 +++++++++++++ secrets/backwards/restic-cloud-sync-key.age | 7 -- .../restic-cloud-sync-repository.age | 7 -- secrets/backwards/restic-password.age | 7 -- secrets/manatee/restic-cloud-sync-key.age | 7 ++ .../manatee/restic-cloud-sync-repository.age | Bin 0 -> 379 bytes secrets/manatee/restic-password.age | 7 ++ secrets/secrets.nix | 6 +- 11 files changed, 74 insertions(+), 99 deletions(-) delete mode 100644 hosts/backwards/modules/restic/default.nix create mode 100644 hosts/manatee/modules/restic/default.nix delete mode 100644 secrets/backwards/restic-cloud-sync-key.age delete mode 100644 secrets/backwards/restic-cloud-sync-repository.age delete mode 100644 secrets/backwards/restic-password.age create mode 100644 secrets/manatee/restic-cloud-sync-key.age create mode 100644 secrets/manatee/restic-cloud-sync-repository.age create mode 100644 secrets/manatee/restic-password.age diff --git a/hosts/backwards/modules/default.nix b/hosts/backwards/modules/default.nix index ea05d4a..319e800 100644 --- a/hosts/backwards/modules/default.nix +++ b/hosts/backwards/modules/default.nix @@ -14,7 +14,6 @@ in git.enable = true; nginx.enable = true; syncthing.enable = true; - restic.enable = true; }; }; } diff --git a/hosts/backwards/modules/restic/default.nix b/hosts/backwards/modules/restic/default.nix deleted file mode 100644 index 72f32f8..0000000 --- a/hosts/backwards/modules/restic/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ lib, config, ... }: -let - enabled = config.mod.restic.enable; -in -{ - options = { - mod.restic = { - enable = lib.mkEnableOption "Enable restic"; - }; - }; - - config = lib.mkIf enabled { - fileSystems."/home/alex/backup" = { - device = "/dev/disk/by-uuid/34601701-65e6-4b2c-ac4d-8bef3dfd743f"; - fsType = "ext4"; - options = [ "nofail" ]; - }; - - services = { - restic.backups = { - "sync-to-external" = { - initialize = true; - - passwordFile = config.age.secrets.restic-password.path; - - paths = [ "/home/alex/sync" ]; - repository = "/home/alex/backup/restic"; - - timerConfig = { - OnCalendar = "*-*-* 0/12:00:00"; # Every 12th hour, i.e. twice a day - Persistent = true; - }; - - pruneOpts = [ - "--keep-daily 1" - "--keep-weekly 7" - "--keep-yearly 12" - ]; - }; - - "sync-to-cloud" = { - initialize = true; - - passwordFile = config.age.secrets.restic-password.path; - environmentFile = config.age.secrets.restic-cloud-sync-key.path; - repositoryFile = config.age.secrets.restic-cloud-sync-repository.path; - - paths = [ "/home/alex/sync" ]; - exclude = [ "/home/alex/sync/reading-material" ]; - - timerConfig = { - OnCalendar = "*-*-* 0/12:00:00"; # Every 12th hour, i.e. twice a day - Persistent = true; - }; - - pruneOpts = [ - "--keep-daily 1" - "--keep-weekly 7" - "--keep-yearly 12" - ]; - }; - }; - }; - - age = { - secrets = { - "restic-password".file = ../../../../secrets/backwards/restic-password.age; - "restic-cloud-sync-key".file = ../../../../secrets/backwards/restic-cloud-sync-key.age; - "restic-cloud-sync-repository".file = - ../../../../secrets/backwards/restic-cloud-sync-repository.age; - }; - }; - }; -} diff --git a/hosts/manatee/modules/default.nix b/hosts/manatee/modules/default.nix index e4e5c1a..77030a0 100644 --- a/hosts/manatee/modules/default.nix +++ b/hosts/manatee/modules/default.nix @@ -16,6 +16,7 @@ in nginx.enable = true; syncthing.enable = true; + restic.enable = true; transmission.enable = true; audiobookshelf.enable = true; jellyfin.enable = true; diff --git a/hosts/manatee/modules/restic/default.nix b/hosts/manatee/modules/restic/default.nix new file mode 100644 index 0000000..86dfc69 --- /dev/null +++ b/hosts/manatee/modules/restic/default.nix @@ -0,0 +1,56 @@ +{ lib, config, ... }: +let + enabled = config.mod.restic.enable; +in +{ + options.mod.restic.enable = lib.mkEnableOption "Enable restic"; + + config = lib.mkIf enabled { + fileSystems."/mnt/backup" = { + device = "/dev/disk/by-uuid/34601701-65e6-4b2c-ac4d-8bef3dfd743f"; + fsType = "ext4"; + options = [ "nofail" ]; + }; + + services.restic.backups = { + "sync-to-external" = { + initialize = true; + passwordFile = config.age.secrets.restic-password.path; + paths = [ "/mnt/sync/public" ]; + repository = "/mnt/backup/restic"; + timerConfig = { + OnCalendar = "*-*-* 0/12:00:00"; + Persistent = true; + }; + pruneOpts = [ + "--keep-daily 1" + "--keep-weekly 7" + "--keep-yearly 12" + ]; + }; + + "sync-to-cloud" = { + initialize = true; + passwordFile = config.age.secrets.restic-password.path; + environmentFile = config.age.secrets.restic-cloud-sync-key.path; + repositoryFile = config.age.secrets.restic-cloud-sync-repository.path; + paths = [ "/mnt/sync/public" ]; + timerConfig = { + OnCalendar = "*-*-* 0/12:00:00"; + Persistent = true; + }; + pruneOpts = [ + "--keep-daily 1" + "--keep-weekly 7" + "--keep-yearly 12" + ]; + }; + }; + + age.secrets = { + "restic-password".file = ../../../../secrets/manatee/restic-password.age; + "restic-cloud-sync-key".file = ../../../../secrets/manatee/restic-cloud-sync-key.age; + "restic-cloud-sync-repository".file = ../../../../secrets/manatee/restic-cloud-sync-repository.age; + }; + }; +} diff --git a/secrets/backwards/restic-cloud-sync-key.age b/secrets/backwards/restic-cloud-sync-key.age deleted file mode 100644 index 8839b21..0000000 --- a/secrets/backwards/restic-cloud-sync-key.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 Pu0HWg rTAkGJbth0WCE8KM50fHaCyXeO/NrmWXiDT/JH9ciAI -kTMVbJRwOSh9Da1O9YYx21/7IdfZrb2OhoOJxNEIKSg --> ssh-ed25519 +oNaHQ DtMpPTuAjS1GyK2WalNJzErEE1mCos/R5aZyMnun+UQ -B81FnJ5z70HzI6yvqiy6Lhr2X9ZjEi5dhM6u47flujA ---- r9HCFWVU5LBiRBdRwOA1+IRBY1/I/1UeukGtFz7BxWE -TK%W*&İ-&8)|07lQ0Ԗ]۸mP^~/#"+)Yn@჌R_pF%# \ No newline at end of file diff --git a/secrets/backwards/restic-cloud-sync-repository.age b/secrets/backwards/restic-cloud-sync-repository.age deleted file mode 100644 index c061a02..0000000 --- a/secrets/backwards/restic-cloud-sync-repository.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 Pu0HWg tZ6zAXOBdiWyyUeOZZ66w1ij8xuHY98fvClPn8/jQVs -AVp3Y04vSbnkurqjAouiDojd5IMFVCYyldXv0v4n9W4 --> ssh-ed25519 +oNaHQ KK44MdrfQLZK44eYWpLiTFm3d/bx6WTsHm98MkvhQTw -CYJJWbpHbLQHvzTWLbujg1AZ3KvgCshVUrolPE1hUho ---- aBOxH3rbMriVBctdVGdQXFH/KYWLbweGzda5sN4HJOA -NoǡO>\I#0+Y8vCS#OeG;-Td,V@3 ]`\bD+6䘤n%NȒ \ No newline at end of file diff --git a/secrets/backwards/restic-password.age b/secrets/backwards/restic-password.age deleted file mode 100644 index b70da10..0000000 --- a/secrets/backwards/restic-password.age +++ /dev/null @@ -1,7 +0,0 @@ -age-encryption.org/v1 --> ssh-ed25519 Pu0HWg qmcWFPndrhXlpjBtSsVNARAOHM9UNtfcEvtSGx/BLHY -EdnzUWju9g61idxWmDaaxSZ6ZiVvhFLOKH3hY1Kyk8s --> ssh-ed25519 +oNaHQ CMBvVWHwVsY89rbdYvVoVeoZlIXLJoIN8xsoqqBnSiA -+xogVU/MBezQzq1rbIOqT5PGNYqM8o0Pmojk2npqT4U ---- mdhPf3weI9cOcaAh9j/CVB+KRfPSRuT678oueeJjdCk -ZmݹӺ*9kwNZh&G kƟA#l uQT,CV3 \ No newline at end of file diff --git a/secrets/manatee/restic-cloud-sync-key.age b/secrets/manatee/restic-cloud-sync-key.age new file mode 100644 index 0000000..8d01d39 --- /dev/null +++ b/secrets/manatee/restic-cloud-sync-key.age @@ -0,0 +1,7 @@ +age-encryption.org/v1 +-> ssh-ed25519 wkRvNA T7nivShTgBPRAWTTOUYWfCWNAFlQ5e6rlB92XV/xRVM +JJrxtTSteza0sCOJVz4z8y/8npX3hWhfo8y85UFAU80 +-> ssh-ed25519 +oNaHQ DuAtW/id53RC4G4EKWr2y1G8K7UbI5r1vGf1ICG5pC8 +xkkGeHOjMmuJ0mKnziUALSEJpV/fVUX5oOBiTptuapo +--- aVjxHPHDuWLhSPMKG5wE67YIzR18LKihrcPqYC+8bnM +b3q|7܇}M ;[ LH% rvdTY.t̩zF*3-D:Y>Tn2FHJM_{$OU䘺,Ñk*lD^Td+ \ No newline at end of file diff --git a/secrets/manatee/restic-cloud-sync-repository.age b/secrets/manatee/restic-cloud-sync-repository.age new file mode 100644 index 0000000000000000000000000000000000000000..7d988caa9ef698d6542dd1506a3b239eda745a3e GIT binary patch literal 379 zcmYdHPt{G$OD?J`D9Oyv)5|YP*Do{V(zR14F3!+RO))YxHMCSH&kic{b5w9NbuW%G z2~M{Rj&KewGYlxrFbhl!$k7fm%klS2^|UCevaCuAD)Y<Z!_2@bBRjCD zs4_PqGcd%*C8Vq{AXVSb+^5W=(!<=(ARw}=Dv&GJ+c?C($hbJ)BceRJ$TTt_F|Q~q z$HmjBFxOeTqOv&6Kfup5&&fBb*p*9HS63m|wDiI?lrI%Ipnr~<+AzS$uf6N^+@oTwX-O{O;*v_(qzoIu-2w_Qp(PPZ^vck MP8U6WOzX=60I5NR)Bpeg literal 0 HcmV?d00001 diff --git a/secrets/manatee/restic-password.age b/secrets/manatee/restic-password.age new file mode 100644 index 0000000..34ef6e8 --- /dev/null +++ b/secrets/manatee/restic-password.age @@ -0,0 +1,7 @@ +age-encryption.org/v1 +-> ssh-ed25519 wkRvNA eL6ZQuNPvdO0gHEW5IObuLQzcOFpOaxzw/wcYvuxfUs +M88b5Ex9I3XY29oYML73BM/0TLo+e4pGG008M2VloKM +-> ssh-ed25519 +oNaHQ hIzDhww0WePNFVdvTwGL9wsOWN9r0ZiUmYkjb82KeQg +DwwCiFXFbYQV64JuRc8pc997CY+2rZxC8cRdTvHPSqA +--- u37YqZsBBtrxZ0Wmw6QJWgazNbqW00GVsQgyRxE41Gc +-bpP W.-:Nc~gHu\MaXprACU)l:+\X\