This commit is contained in:
Joseph Hanson 2024-07-26 22:25:10 -05:00
parent 59e0545be0
commit e5ea595228
Signed by: jahanson
SSH key fingerprint: SHA256:vy6dKBECV522aPAwklFM3ReKAVB086rT3oWwiuiFG7o
3 changed files with 64 additions and 19 deletions

View file

@ -93,7 +93,7 @@ in
# repo = "ssh://t3zvn0dd@t3zvn0dd.repo.borgbase.com/./repo"; # repo = "ssh://t3zvn0dd@t3zvn0dd.repo.borgbase.com/./repo";
# repoKeyPath = "/run/secrets/borgbackup/telchar"; # repoKeyPath = "/run/secrets/borgbackup/telchar";
# }; # };
};
services = { services = {
podman.enable = true; podman.enable = true;
libvirt-qemu.enable = true; libvirt-qemu.enable = true;
@ -115,4 +115,4 @@ in
}; };
}; };
}; };
} }

View file

@ -0,0 +1,44 @@
{ lib, config, ... }:
let
cfg = config.mySystem.system.borgbackup;
in
{
options.mySystem.system.borgbackup = {
enable = lib.mkEnableOption "borgbackup";
paths = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
required = true;
};
exclude = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
required = false;
};
repo = lib.mkOption {
example = "borgbackup@myserver:repo";
type = lib.types.str;
default = "";
required = true;
};
repoKeyPath = lib.mkOption {
example = "/run/secrets/borgbackup/telchar";
type = lib.types.str;
default = "";
required = false;
};
};
config = lib.mkIf cfg.enable {
services.borgbackup.jobs."borgbackup" = {
paths = cfg.paths;
exclude = cfg.exclude;
repo = cfg.repo;
encryption = {
mode = "repokey-blake2";
passCommand = "cat ${cfg.repoKeyPath}";
};
environment.BORG_RSH = "ssh -i /etc/ssh/ssh_host_ed25519_key";
};
};
}

View file

@ -1,5 +1,6 @@
{ {
imports = [ imports = [
./borg
./impermanence.nix ./impermanence.nix
./motd ./motd
./nix.nix ./nix.nix