mirror of
https://git.mediani.de/mirrors_public/oddlama_nixos-extra-modules.git
synced 2025-10-10 22:10:38 +02:00
feat(restic): add hetzner storage box hostkey
This commit is contained in:
parent
3057e049e7
commit
cab2f4b040
1 changed files with 17 additions and 2 deletions
|
@ -5,10 +5,15 @@
|
||||||
}: let
|
}: let
|
||||||
inherit
|
inherit
|
||||||
(lib)
|
(lib)
|
||||||
|
flatten
|
||||||
|
flip
|
||||||
|
mapAttrsToList
|
||||||
mkEnableOption
|
mkEnableOption
|
||||||
mkIf
|
mkIf
|
||||||
mkOption
|
mkOption
|
||||||
|
optional
|
||||||
types
|
types
|
||||||
|
unique
|
||||||
;
|
;
|
||||||
in {
|
in {
|
||||||
options.services.restic.backups = mkOption {
|
options.services.restic.backups = mkOption {
|
||||||
|
@ -47,14 +52,24 @@ in {
|
||||||
|
|
||||||
config = let
|
config = let
|
||||||
subuser = "${submod.config.hetznerStorageBox.mainUser}-sub${toString submod.config.hetznerStorageBox.subUid}";
|
subuser = "${submod.config.hetznerStorageBox.mainUser}-sub${toString submod.config.hetznerStorageBox.subUid}";
|
||||||
url = "${subuser}@${subuser}.your-storagebox.de";
|
url = "${subuser}@${submod.config.hetznerStorageBox.mainUser}.your-storagebox.de";
|
||||||
in
|
in
|
||||||
mkIf submod.config.hetznerStorageBox.enable {
|
mkIf submod.config.hetznerStorageBox.enable {
|
||||||
repository = "sftp://${url}:23/";
|
repository = "sftp://${url}:23/";
|
||||||
extraOptions = [
|
extraOptions = [
|
||||||
"sftp.command='ssh -s sftp -p 23 -i ${config.age.secrets.${submod.config.hetznerStorageBox.sshAgeSecret}.path} ${url}'"
|
"sftp.command='ssh -p23 ${url} -i ${config.age.secrets.${submod.config.hetznerStorageBox.sshAgeSecret}.path} -s sftp'"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config.services.openssh.knownHosts.hetzner-storage-boxes = let
|
||||||
|
hetznerStorageBoxHostnames =
|
||||||
|
unique (flatten (flip mapAttrsToList config.services.restic.backups
|
||||||
|
(_: backupCfg: optional backupCfg.hetznerStorageBox.enable "[${backupCfg.hetznerStorageBox.mainUser}.your-storagebox.de]:23")));
|
||||||
|
in
|
||||||
|
mkIf (hetznerStorageBoxHostnames != []) {
|
||||||
|
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs";
|
||||||
|
hostNames = hetznerStorageBoxHostnames;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue