From c7ec1a542352fe2abe855cc52c3e7e3bf0b3ce94 Mon Sep 17 00:00:00 2001 From: Romain Paquet Date: Thu, 26 Mar 2026 21:16:42 +0000 Subject: [PATCH] backups: refactor and add renoir --- clan/backups.nix | 41 +++++++++++++++++++++++++++++++++++++ clan/flake-module.nix | 27 +----------------------- nixosModules/storagebox.nix | 12 ----------- 3 files changed, 42 insertions(+), 38 deletions(-) create mode 100644 clan/backups.nix delete mode 100644 nixosModules/storagebox.nix diff --git a/clan/backups.nix b/clan/backups.nix new file mode 100644 index 0000000..dc0a8c6 --- /dev/null +++ b/clan/backups.nix @@ -0,0 +1,41 @@ +{ lib, self, ... }: +{ + clan.inventory.instances."borgbackup-storagebox" = { + module.input = "clan-core"; + module.name = "borgbackup"; + + roles.client.machines = lib.genAttrs [ "crocus" "genepi" "renoir" "verbena" ] ( + machine: + let + config = self.nixosConfigurations.${machine}.config; + user = "u422292"; + host = "${user}.your-storagebox.de"; + in + { + settings.destinations."storagebox-${config.networking.hostName}" = { + repo = "${user}@${host}:./borgbackup/${config.networking.hostName}"; + rsh = "ssh -oPort=23 -i ${ + config.clan.core.vars.generators.borgbackup.files."borgbackup.ssh".path + } -oStrictHostKeyChecking=accept-new"; + }; + } + ); + roles.client.extraModules = [ + { + programs.ssh.knownHosts = + let + user = "u422292"; + host = "${user}.your-storagebox.de"; + in + { + storagebox-ed25519 = { + hostNames = [ "[${host}]:23" ]; + publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs"; + }; + }; + } + + ]; + roles.server.machines = { }; + }; +} diff --git a/clan/flake-module.nix b/clan/flake-module.nix index de97fbb..9ab6fd9 100644 --- a/clan/flake-module.nix +++ b/clan/flake-module.nix @@ -1,6 +1,7 @@ { self, lib, ... }: { imports = [ + ./backups.nix ./machines.nix ./monitoring.nix ./network.nix @@ -89,32 +90,6 @@ roles.default.tags.all = { }; }; - clan.inventory.instances."borgbackup-storagebox" = { - module.input = "clan-core"; - module.name = "borgbackup"; - - roles.client.machines = lib.genAttrs [ "crocus" "genepi" "verbena" ] ( - machine: - let - config = self.nixosConfigurations.${machine}.config; - user = "u422292"; - host = "${user}.your-storagebox.de"; - in - { - settings.destinations."storagebox-${config.networking.hostName}" = { - repo = "${user}@${host}:./borgbackup/${config.networking.hostName}"; - rsh = "ssh -oPort=23 -i ${ - config.clan.core.vars.generators.borgbackup.files."borgbackup.ssh".path - } -oStrictHostKeyChecking=accept-new"; - }; - } - ); - roles.client.extraModules = [ - self.nixosModules.storagebox - ]; - roles.server.machines = { }; - }; - clan.inventory.instances.syncthing = { roles.peer.tags.syncthing = { }; roles.peer.settings.folders = { diff --git a/nixosModules/storagebox.nix b/nixosModules/storagebox.nix deleted file mode 100644 index bee2255..0000000 --- a/nixosModules/storagebox.nix +++ /dev/null @@ -1,12 +0,0 @@ -let - user = "u422292"; - host = "${user}.your-storagebox.de"; -in -{ - programs.ssh.knownHosts = { - storagebox-ed25519 = { - hostNames = [ "[${host}]:23" ]; - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs"; - }; - }; -}