From 155f6291594e522f05c564ab13caf88b518ea54c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Mon, 9 Jun 2025 02:42:17 +0200 Subject: [PATCH] chore: prune restic repo before backup --- SwarselSystems.org | 5 +- index.html | 217 +++++++++++++++++--------------- modules/nixos/server/restic.nix | 5 +- 3 files changed, 122 insertions(+), 105 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index d054404..c135a5b 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -7750,7 +7750,7 @@ Here we just define some aliases for rebuilding the system, and we allow some in This manages backups for my pictures and obsidian files. #+begin_src nix :tangle modules/nixos/server/restic.nix - { lib, config, inputs, ... }: + { lib, pkgs, config, inputs, ... }: let secretsDirectory = builtins.toString inputs.nix-secrets; resticRepo = lib.swarselsystems.getSecret "${secretsDirectory}/restic/wintersRepo"; @@ -7792,6 +7792,9 @@ This manages backups for my pictures and obsidian files. "--keep-monthly 3" "--keep-yearly 100" ]; + backupPrepareCommand = '' + ${pkgs.restic}/bin/restic prune + ''; repository = "${resticRepo}"; initialize = true; timerConfig = { diff --git a/index.html b/index.html index 52dc083..70d9726 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + SwarselSystems: NixOS + Emacs Configuration @@ -263,9 +263,9 @@
  • 3.1.4.3. Home-manager only (default non-NixOS)
  • 3.1.4.4. ChaosTheatre (Demo Physical/VM)
  • @@ -305,7 +305,7 @@
  • 3.2.1.27. fhs
  • 3.2.1.28. swarsel-displaypower
  • 3.2.1.29. swarsel-mgba
  • -
  • 3.2.1.30. sshrm
  • +
  • 3.2.1.30. sshrm
  • 3.2.2. Overlays (additions, overrides, nixpkgs-stable)
  • @@ -313,28 +313,28 @@ @@ -379,7 +379,7 @@
  • 3.3.1.22.3. enable GVfs
  • 3.3.1.22.4. interception-tools: Make CAPS work as ESC/CTRL
  • 3.3.1.22.5. power-profiles-daemon
  • -
  • 3.3.1.22.6. SwayOSD
  • +
  • 3.3.1.22.6. SwayOSD
  • 3.3.1.23. Hardware compatibility settings (Yubikey, Ledger, Keyboards) - udev rules @@ -445,11 +445,11 @@
  • 3.3.4.3. VmWare
  • 3.3.4.4. Auto-login
  • 3.3.4.5. nswitch-rcm
  • -
  • 3.3.4.6. Framework
  • -
  • 3.3.4.7. AMD CPU
  • -
  • 3.3.4.8. AMD GPU
  • -
  • 3.3.4.9. Hibernation
  • -
  • 3.3.4.10. BTRFS
  • +
  • 3.3.4.6. Framework
  • +
  • 3.3.4.7. AMD CPU
  • +
  • 3.3.4.8. AMD GPU
  • +
  • 3.3.4.9. Hibernation
  • +
  • 3.3.4.10. BTRFS
  • 3.3.4.11. work
  • 3.3.4.12. Minimal Install
  • @@ -498,7 +498,7 @@
  • 3.4.1.29.1. gnome-keyring
  • 3.4.1.29.2. KDE Connect
  • 3.4.1.29.3. Mako
  • -
  • 3.4.1.29.4. SwayOSD
  • +
  • 3.4.1.29.4. SwayOSD
  • 3.4.1.29.5. yubikey-touch-detector
  • @@ -523,7 +523,7 @@ @@ -701,7 +701,7 @@ @@ -710,7 +710,7 @@

    -This file has 62776 words spanning 16458 lines and was last revised on 2025-05-24 21:14:33 +0200. +This file has 62780 words spanning 16469 lines and was last revised on 2025-06-09 02:48:45 +0200.

    @@ -763,7 +763,7 @@ This section defines my Emacs configuration. For a while, I considered to use ry

    -My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2025-05-24 21:14:33 +0200) +My emacs is built using the emacs-overlay nix flake, which builds a bleeding edge emacs on wayland (pgtk) with utilities like treesitter support. By executing the below source block, the current build setting can be updated at any time, and you can see my most up-to-date build options (last updated: 2025-06-09 02:48:45 +0200)

    @@ -2802,8 +2802,8 @@ This is just a demo host. It applies all the configuration found in the common p I also set the WLR_RENDERER_ALLOW_SOFTWARE=1 to allow this configuration to run in a virtualized environment. I also enable qemuGuest for a smoother experience when testing on QEMU.

    -
    -
    3.1.4.4.1. Main configuration
    +
    +
    3.1.4.4.1. Main configuration
    { self, inputs, config, pkgs, lib, primaryUser, ... }:
    @@ -2882,8 +2882,8 @@ in
     
    -
    -
    3.1.4.4.2. NixOS dummy options configuration
    +
    +
    3.1.4.4.2. NixOS dummy options configuration
    _:
    @@ -2893,8 +2893,8 @@ in
     
    -
    -
    3.1.4.4.3. home-manager dummy options configuration
    +
    +
    3.1.4.4.3. home-manager dummy options configuration
    _:
    @@ -4671,8 +4671,8 @@ appimageTools.wrapType2 {
     
    -
    -
    3.2.1.30. sshrm
    +
    +
    3.2.1.30. sshrm

    This programs simply runs ssh-keygen on the last host that I tried to ssh into. I need this frequently when working with cloud-init usually. @@ -4829,8 +4829,8 @@ in

    -
    -
    3.2.3.1.1. Personal
    +
    +
    3.2.3.1.1. Personal
    { lib, config, ... }:
    @@ -4897,8 +4897,8 @@ in
     
    -
    -
    3.2.3.1.2. Chaostheatre
    +
    +
    3.2.3.1.2. Chaostheatre
    { lib, config, ... }:
    @@ -4962,8 +4962,8 @@ in
     
    -
    -
    3.2.3.1.3. toto
    +
    +
    3.2.3.1.3. toto
    { lib, config, ... }:
    @@ -4995,8 +4995,8 @@ in
     
    -
    -
    3.2.3.1.4. Work
    +
    +
    3.2.3.1.4. Work
    { lib, config, ... }:
    @@ -5017,8 +5017,8 @@ in
     
    -
    -
    3.2.3.1.5. Framework
    +
    +
    3.2.3.1.5. Framework
    { lib, config, ... }:
    @@ -5039,8 +5039,8 @@ in
     
    -
    -
    3.2.3.1.6. AMD CPU
    +
    +
    3.2.3.1.6. AMD CPU
    { lib, config, ... }:
    @@ -5061,8 +5061,8 @@ in
     
    -
    -
    3.2.3.1.7. AMD GPU
    +
    +
    3.2.3.1.7. AMD GPU
    { lib, config, ... }:
    @@ -5083,8 +5083,8 @@ in
     
    -
    -
    3.2.3.1.8. Hibernation
    +
    +
    3.2.3.1.8. Hibernation
    { lib, config, ... }:
    @@ -5105,8 +5105,8 @@ in
     
    -
    -
    3.2.3.1.9. BTRFS
    +
    +
    3.2.3.1.9. BTRFS
    { lib, config, ... }:
    @@ -5127,8 +5127,8 @@ in
     
    -
    -
    3.2.3.1.10. Local Server
    +
    +
    3.2.3.1.10. Local Server
    { lib, config, ... }:
    @@ -5168,6 +5168,7 @@ in
               monitoring = lib.mkDefault true;
               emacs = lib.mkDefault true;
               freshrss = lib.mkDefault true;
    +          jenkins = lib.mkDefault false;
             };
           };
         };
    @@ -5179,8 +5180,8 @@ in
     
    -
    -
    3.2.3.1.11. OCI Sync Server
    +
    +
    3.2.3.1.11. OCI Sync Server
    { lib, config, ... }:
    @@ -5237,8 +5238,8 @@ in
     
    -
    -
    3.2.3.2.1. Personal
    +
    +
    3.2.3.2.1. Personal
    { lib, config, ... }:
    @@ -5295,8 +5296,8 @@ in
     
    -
    -
    3.2.3.2.2. Chaostheatre
    +
    +
    3.2.3.2.2. Chaostheatre
    { lib, config, ... }:
    @@ -5348,8 +5349,8 @@ in
     
    -
    -
    3.2.3.2.3. toto
    +
    +
    3.2.3.2.3. toto
    { lib, config, ... }:
    @@ -5369,8 +5370,8 @@ in
     
    -
    -
    3.2.3.2.4. Work
    +
    +
    3.2.3.2.4. Work
    { lib, config, ... }:
    @@ -5390,8 +5391,8 @@ in
     
    -
    -
    3.2.3.2.5. Framework
    +
    +
    3.2.3.2.5. Framework
    { lib, config, ... }:
    @@ -5412,8 +5413,8 @@ in
     
    -
    -
    3.2.3.2.6. Darwin
    +
    +
    3.2.3.2.6. Darwin
    { lib, config, ... }:
    @@ -5431,8 +5432,8 @@ in
     
    -
    -
    3.2.3.2.7. Local Server
    +
    +
    3.2.3.2.7. Local Server
    { lib, config, ... }:
    @@ -6965,8 +6966,8 @@ Most of the time I am using power-saver, however, it is good to be
     
    -
    -
    3.3.1.22.6. SwayOSD
    +
    +
    3.3.1.22.6. SwayOSD
    { lib, pkgs, config, ... }:
    @@ -7935,7 +7936,7 @@ in
         ];
     
     
    -    users.users.jellyfin = {
    +    users.users.kavita = {
           extraGroups = [ "users" ];
         };
     
    @@ -8075,7 +8076,7 @@ in
             LogLevel = "debug";
             Address = "127.0.0.1";
             Port = 4040;
    -        MusicFolder = "/Vault/Eternor/Musik";
    +        MusicFolder = "/Vault/Eternor/Music";
             EnableSharing = true;
             EnableTranscodingConfig = true;
             Scanner.GroupAlbumReleases = true;
    @@ -9037,11 +9038,11 @@ in
     
    3.3.2.20. restic

    -Once this is finished, it will house a restic client that manages automatic backups of my image library. Before I get to this however, I first need to organice my pictures in the first place. +This manages backups for my pictures and obsidian files.

    -
    { lib, config, inputs, ... }:
    +
    { lib, pkgs, config, inputs, ... }:
     let
       secretsDirectory = builtins.toString inputs.nix-secrets;
       resticRepo = lib.swarselsystems.getSecret "${secretsDirectory}/restic/wintersRepo";
    @@ -9075,11 +9076,21 @@ in
                 "/Vault/data/paperless"
                 "/Vault/Eternor/Bilder"
                 "/Vault/Eternor/Immich"
    +            "/Vault/familymedia"
               ];
    +          pruneOpts = [
    +            "--keep-daily 3"
    +            "--keep-weekly 2"
    +            "--keep-monthly 3"
    +            "--keep-yearly 100"
    +          ];
    +          backupPrepareCommand = ''
    +            ${pkgs.restic}/bin/restic prune
    +          '';
               repository = "${resticRepo}";
               initialize = true;
               timerConfig = {
    -            OnCalendar = "19:00";
    +            OnCalendar = "03:00";
               };
             };
     
    @@ -9717,8 +9728,8 @@ This smashes Atmosphere 1.3.2 on the switch, which is what I am currenty using.
     
    -
    -
    3.3.4.6. Framework
    +
    +
    3.3.4.6. Framework

    This holds configuration that is specific to framework laptops. @@ -9756,8 +9767,8 @@ This holds configuration that is specific to framework laptops.

    -
    -
    3.3.4.7. AMD CPU
    +
    +
    3.3.4.7. AMD CPU
    { lib, config, ... }:
    @@ -9773,8 +9784,8 @@ This holds configuration that is specific to framework laptops.
     
    -
    -
    3.3.4.8. AMD GPU
    +
    +
    3.3.4.8. AMD GPU
    { lib, config, ... }:
    @@ -9796,8 +9807,8 @@ This holds configuration that is specific to framework laptops.
     
    -
    -
    3.3.4.9. Hibernation
    +
    +
    3.3.4.9. Hibernation
    { lib, config, ... }:
    @@ -9828,8 +9839,8 @@ This holds configuration that is specific to framework laptops.
     
    -
    -
    3.3.4.10. BTRFS
    +
    +
    3.3.4.10. BTRFS
    { lib, config, ... }:
    @@ -10627,6 +10638,7 @@ This holds packages that I can use as provided, or with small modifications (as
           # printing
           cups
           simple-scan
    +      cura-appimage
     
           # dict
           (aspellWithDicts (dicts: with dicts; [ de en en-computers en-science ]))
    @@ -10807,7 +10819,6 @@ This is just a separate container for derivations defined in 
    -
    3.4.1.29.4. SwayOSD
    +
    +
    3.4.1.29.4. SwayOSD
    { lib, config, ... }:
    @@ -14027,8 +14038,8 @@ in
     
    -
    -
    3.4.4.3. Framework
    +
    +
    3.4.4.3. Framework

    This holds configuration that is specific to framework laptops. @@ -17868,8 +17879,8 @@ autocmd DocStart vc-impimba-1.m.imp.ac.at/ui/webconsole mode ignore

    -
    -

    6.3. tridactyl theme

    +
    +

    6.3. tridactyl theme

    @@ -18366,7 +18377,7 @@ sync USER HOST:
     
    diff --git a/modules/nixos/server/restic.nix b/modules/nixos/server/restic.nix index e5187bd..26d41af 100644 --- a/modules/nixos/server/restic.nix +++ b/modules/nixos/server/restic.nix @@ -1,4 +1,4 @@ -{ lib, config, inputs, ... }: +{ lib, pkgs, config, inputs, ... }: let secretsDirectory = builtins.toString inputs.nix-secrets; resticRepo = lib.swarselsystems.getSecret "${secretsDirectory}/restic/wintersRepo"; @@ -40,6 +40,9 @@ in "--keep-monthly 3" "--keep-yearly 100" ]; + backupPrepareCommand = '' + ${pkgs.restic}/bin/restic prune + ''; repository = "${resticRepo}"; initialize = true; timerConfig = {