From 1080e5166b022a67b22fa43c2b57adca9b40f379 Mon Sep 17 00:00:00 2001 From: etwas Date: Mon, 8 Dec 2025 15:15:03 +0100 Subject: [PATCH] fix: have restic be a system service --- home/default.nix | 6 ----- home/essentials/default.nix | 1 - modules/utils/default.nix | 1 + {home/essentials => modules/utils}/restic.nix | 23 ++++++++++++------- 4 files changed, 16 insertions(+), 15 deletions(-) rename {home/essentials => modules/utils}/restic.nix (59%) diff --git a/home/default.nix b/home/default.nix index 930f579..c752f40 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,5 +1,4 @@ { - config, pkgs, inputs, spicetify-nix, @@ -48,11 +47,6 @@ ./misc_pkgs ./wm ]; - - services.restic.backups.localbackup = { - passwordFile = config.age.secrets.restic-password.path; - environmentFile = config.age.secrets.restic-s3-key.path; - }; }; }; diff --git a/home/essentials/default.nix b/home/essentials/default.nix index 9c34665..2dab1c9 100644 --- a/home/essentials/default.nix +++ b/home/essentials/default.nix @@ -2,7 +2,6 @@ imports = [ ./git.nix ./keyring.nix - ./restic.nix ./ssh.nix ./zsh.nix ]; diff --git a/modules/utils/default.nix b/modules/utils/default.nix index 6ab9934..c14c6ab 100644 --- a/modules/utils/default.nix +++ b/modules/utils/default.nix @@ -3,6 +3,7 @@ ./auth.nix ./docker.nix ./printing.nix + ./restic.nix ./wm.nix ]; } diff --git a/home/essentials/restic.nix b/modules/utils/restic.nix similarity index 59% rename from home/essentials/restic.nix rename to modules/utils/restic.nix index 84c5b6b..eabb0ef 100644 --- a/home/essentials/restic.nix +++ b/modules/utils/restic.nix @@ -1,29 +1,36 @@ -{ ... }: +{ config, ... }: { services.restic = { - enable = true; - backups = { localbackup = { + passwordFile = config.age.secrets.restic-password.path; + environmentFile = config.age.secrets.restic-s3-key.path; + exclude = [ - "/home/$USER/.cache" - "/home/$USER/.local/share/libvirt" - "/home/$USER/.local/share/Steam" - "/home/$USER/.local/share/Trash" - "/home/$USER/Android" + "home/*/.local/share/libvirt" + "home/*/.local/share/Steam" + "home/*/.local/share/Trash" + "home/*/Android" + ".cache" + ".mozilla" ".venv" "venv" ".direnv" ".git" ]; + initialize = true; + paths = [ "/home" ]; + extraBackupArgs = [ "--one-file-system" ]; + repository = "s3:https://s3.filmsli.de/restic-framework"; + pruneOpts = [ "--keep-daily 7" "--keep-weekly 4"