diff options
| author | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-06 21:20:24 +0100 |
|---|---|---|
| committer | Gregor Kleen <gkleen@yggdrasil.li> | 2022-02-06 21:20:24 +0100 |
| commit | 32282ae39d352428988891207fb4f276a311846a (patch) | |
| tree | 03b3e562996b5c47b29fbc43beae72801fc66844 /hosts/vidhar/borg/default.nix | |
| parent | ab822140ffb2980ced0026bbd6e4f417b53451b0 (diff) | |
| download | nixos-32282ae39d352428988891207fb4f276a311846a.tar nixos-32282ae39d352428988891207fb4f276a311846a.tar.gz nixos-32282ae39d352428988891207fb4f276a311846a.tar.bz2 nixos-32282ae39d352428988891207fb4f276a311846a.tar.xz nixos-32282ae39d352428988891207fb4f276a311846a.zip | |
vidhar: borg
Diffstat (limited to 'hosts/vidhar/borg/default.nix')
| -rw-r--r-- | hosts/vidhar/borg/default.nix | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/hosts/vidhar/borg/default.nix b/hosts/vidhar/borg/default.nix new file mode 100644 index 00000000..d338dfd6 --- /dev/null +++ b/hosts/vidhar/borg/default.nix | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | { pkgs, lib, ... }: | ||
| 2 | |||
| 3 | with lib; | ||
| 4 | |||
| 5 | { | ||
| 6 | config = { | ||
| 7 | services.borgbackup.repos.borg = { | ||
| 8 | path = "/srv/backup/borg"; | ||
| 9 | authorizedKeysAppendOnly = let | ||
| 10 | dir = ./authorized-keys; | ||
| 11 | toAuthKey = fname: ftype: if ftype != "regular" || !(hasSuffix ".pub" fname) then null else builtins.readFile (dir + "/${fname}"); | ||
| 12 | in filter (v: v != null) (lib.mapAttrsToList toAuthKey (builtins.readDir dir)); | ||
| 13 | }; | ||
| 14 | |||
| 15 | boot.postBootCommands = mkBefore '' | ||
| 16 | ${pkgs.findutils}/bin/find /srv/backup/borg -maxdepth 1 -type d -empty -delete | ||
| 17 | ''; | ||
| 18 | |||
| 19 | services.openssh.extraConfig = '' | ||
| 20 | Match User borg | ||
| 21 | ClientAliveInterval 10 | ||
| 22 | ClientAliveCountMax 30 | ||
| 23 | |||
| 24 | Match All | ||
| 25 | ''; | ||
| 26 | |||
| 27 | sops.secrets.borg-passphrase = { | ||
| 28 | sopsFile = ./passphrase.yaml; | ||
| 29 | format = "yaml"; | ||
| 30 | key = "borg"; | ||
| 31 | owner = "borg"; | ||
| 32 | group = "borg"; | ||
| 33 | mode = "0440"; | ||
| 34 | }; | ||
| 35 | }; | ||
| 36 | } | ||
