Skip to content

Commit

Permalink
git: back up Git repositories with BorgBackup
Browse files Browse the repository at this point in the history
  • Loading branch information
wagdav committed Oct 27, 2024
1 parent 0089397 commit fd37c49
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions modules/git.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
httpPort = 8022;

in
{
imports = [ ./consul-catalog.nix ];
imports = [
./consul-catalog.nix
./nas.nix
];

users.users.git = {
isSystemUser = true;
Expand Down Expand Up @@ -45,6 +48,29 @@ in
tags = (import ./lib/traefik.nix).tagsForHost "git";
}
];

borgbackup.jobs.git = {
paths = "/srv/git";
repo = "/mnt/nas/backup/borg/git";
encryption.mode = "none";
doInit = false;
user = "borg";
group = "git";
startAt = "daily";
prune.keep = {
within = "1d";
daily = 7;
weekly = 4;
monthly = 12;
yearly = 10;
};
};
};

users.users.borg = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "git" ];
};

networking.firewall.allowedTCPPorts = [ httpPort ];
Expand Down

0 comments on commit fd37c49

Please sign in to comment.