machines: update backup ssh keys and extend service

This commit is contained in:
Felix Buehler 2023-02-08 00:52:42 +01:00
parent f03b4e4bd1
commit a1967f0b4b
3 changed files with 27 additions and 9 deletions

View file

@ -1,7 +1,6 @@
{ config, lib, pkgs, ... }:
let
cfg = config.my.services.backup;
borgbackupPath = "u181505-sub1@u181505-sub1.your-storagebox.de";
in
{
options.my.services.backup = with lib; {
@ -12,6 +11,25 @@ in
description = "Password for the backup";
example = "/run/secrets/password";
};
sshHost = mkOption {
type = types.str;
description = "ssh-hostname for remote access";
default = "u181505-sub1.your-storagebox.de";
example = "test.domain.com";
};
sshUser = mkOption {
type = types.str;
description = "ssh-user for remote access";
default = "u181505-sub1";
example = "max";
};
sshPort = mkOption {
type = types.port;
description = "ssh-port for remote access";
default = 23;
example = 22;
};
sshKeyFile = mkOption {
type = types.path;
description = "ssh-key for remote access";
@ -89,8 +107,8 @@ in
passCommand = "cat ${cfg.passwordFile}";
};
environment.BORG_RSH = "ssh -o 'StrictHostKeyChecking=no' -i ${cfg.sshKeyFile} -p 23";
repo = borgbackupPath + ":${config.networking.hostName}/";
environment.BORG_RSH = "ssh -o 'StrictHostKeyChecking=no' -i ${cfg.sshKeyFile} -p ${toString cfg.sshPort}";
repo = "${cfg.sshUser}@${cfg.sshHost}:${config.networking.hostName}/";
doInit = false;
compression = "auto,zstd";