From fa3c444880d83e62e98c69b8e885f28dba3e6c11 Mon Sep 17 00:00:00 2001
From: Gregor Kleen <gkleen@yggdrasil.li>
Date: Tue, 14 Mar 2023 09:53:19 +0100
Subject: ...

---
 hosts/surtr/bifrost/default.nix |  1 +
 hosts/vidhar/borg/default.nix   | 14 ++++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/hosts/surtr/bifrost/default.nix b/hosts/surtr/bifrost/default.nix
index ccf0c959..20cd5892 100644
--- a/hosts/surtr/bifrost/default.nix
+++ b/hosts/surtr/bifrost/default.nix
@@ -65,6 +65,7 @@ in {
       serviceConfig = {
         Type = "oneshot";
         ExecStart = "${pkgs.preserve-dscp}/bin/preserve-dscp bifrost ens3";
+        RemainAfterExit = true;
         ExecStop = "${pkgs.preserve-dscp}/bin/preserve-dscp bifrost ens3 --unload";
       };
     };
diff --git a/hosts/vidhar/borg/default.nix b/hosts/vidhar/borg/default.nix
index 9a51b103..922cbf02 100644
--- a/hosts/vidhar/borg/default.nix
+++ b/hosts/vidhar/borg/default.nix
@@ -45,6 +45,8 @@ let
       ];
     };
   };
+
+  baseDir = "/srv/backup/borg";
 in {
   config = {
     services.borgsnap = {
@@ -56,7 +58,7 @@ in {
     };
 
     services.copyborg.jotnar = {
-      from = "/srv/backup/borg/jotnar";
+      from = "${baseDir}/jotnar";
       to = "yggdrasil.borgbase:repo";
       inherit sshConfig;
       keyfile = config.sops.secrets."yggdrasil.borgkey".path;
@@ -67,14 +69,14 @@ in {
 
     services.borgbackup.repos = {
       jotnar = {
-        path = "/srv/backup/borg/jotnar";
+        path = "${baseDir}/jotnar";
         authorizedKeysAppendOnly = let
           dir = ./jotnar;
           toAuthKey = fname: ftype: if ftype != "regular" || !(hasSuffix ".pub" fname) then null else builtins.readFile (dir + "/${fname}");
         in filter (v: v != null) (mapAttrsToList toAuthKey (builtins.readDir dir));
       };
       "uniworx.de" = {
-        path = "/srv/backups/borg/uniworx.de";
+        path = "${baseDir}/uniworx.de";
         authorizedKeys = [
           (builtins.readFile ./uniworx.de/root.pub)
         ];
@@ -84,7 +86,7 @@ in {
       };
     };
 
-    # systemd.services."check-borg@${utils.escapeSystemdPath "/srv/backup/borg/jotnar"}" = checkBorgUnit;
+    # systemd.services."check-borg@${utils.escapeSystemdPath "${baseDir}/jotnar"}" = checkBorgUnit;
     # systemd.services."check-borg@${utils.escapeSystemdPath "yggdrasil.borgbase:repo"}" = recursiveUpdate checkBorgUnit {
     #   serviceConfig = {
     #     Environment = checkBorgUnit.serviceConfig.Environment ++ [
@@ -92,7 +94,7 @@ in {
     #     ];
     #   };
     # };
-    # systemd.timers."check-borg@${utils.escapeSystemdPath "/srv/backup/borg/jotnar"}" = {
+    # systemd.timers."check-borg@${utils.escapeSystemdPath "${baseDir}/jotnar"}" = {
     #   wantedBy = [ "timers.target" ];
     #   timerConfig = {
     #     OnCalendar = "*-*-* 00:30:00 UTC";
@@ -106,7 +108,7 @@ in {
     # };
 
     boot.postBootCommands = mkBefore ''
-      ${pkgs.findutils}/bin/find /srv/backup/borg -type d -empty -delete
+      ${pkgs.findutils}/bin/find ${baseDir} -type d -empty -delete
     '';
 
     users.users.borg.extraGroups = ["ssh"];
-- 
cgit v1.2.3