feat(backups): backups work

This commit is contained in:
strix 2026-08-28 00:46:08 +02:00
parent 12251ef703
commit bd964bad48
6 changed files with 83 additions and 6 deletions

View file

@ -0,0 +1,49 @@
{
config,
lib,
pkgs,
...
}:
{
programs.ssh.extraConfig = ''
Host nas01-backup
HostName 10.1.0.2
User _sa_backup
IdentityFile /etc/5335/id_backup_nas01
IdentitiesOnly yes
StrictHostKeyChecking accept-new
'';
services.restic.backups.system = {
initialize = true;
inhibitsSleep = true;
paths = [
"/etc"
"/srv"
"/boot"
"/home"
];
exclude = [
"/home/*/.cache"
"/home/*/.local/share/Steam"
"/home/*/.local/share/Trash"
"/home/*/.lmstudio"
"/home/*/Games"
"/home/*/Downloads"
"/home/*/Projects/**/target"
];
repository = "sftp:nas01-backup:/h_Backups/${config.networking.hostName}";
passwordFile = "/etc/5335/restic-password";
pruneOpts = [
"--keep-daily 7"
"--keep-weekly 5"
"--keep-monthly 6"
"--keep-yearly 10"
];
timerConfig = {
OnCalendar = "daily";
Persistent = true;
RandomizedDelaySec = "5h";
};
};
}

View file

@ -1,5 +1,8 @@
{ ... }:
{
imports = [
./firewall.nix
];
networking.networkmanager.enable = true;
networking.firewall.enable = true;
}

View file

@ -0,0 +1,7 @@
{ ... }:
{
networking.firewall.enable = true;
networking.firewall.allowedTCPPorts = [ 8080 ];
networking.firewall.allowedUDPPorts = [ 8080 ];
}

View file

@ -0,0 +1,13 @@
{ config, ... }:
{
services.tailscale = {
enable = true;
extraUpFlags = [ "--accept-routes" ];
};
networking.firewall.trustedInterfaces = [ config.services.tailscale.interfaceName ];
networking.firewall.allowedUDPPorts = [ config.services.tailscale.port ];
systemd.network.wait-online.enable = false;
boot.initrd.systemd.network.wait-online.enable = false;
}