summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarkus S. Wamser <github-dev@mail2013.wamser.eu>2023-07-20 09:15:07 +0200
committerMarkus S. Wamser <github-dev@mail2013.wamser.eu>2023-07-21 11:37:15 +0200
commita936b9edec45591e04dd2caa79cb87b6e87c8619 (patch)
treed6118144fa4f220cf3efe5b4c34c29b95e55308d
parentd0c7a8f1c9a2ebfebd3d99960cdb7c4eec442dc9 (diff)
downloadnixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.tar
nixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.tar.gz
nixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.tar.bz2
nixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.tar.lz
nixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.tar.xz
nixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.tar.zst
nixpkgs-a936b9edec45591e04dd2caa79cb87b6e87c8619.zip
tarsnap: add package option
-rw-r--r--nixos/modules/services/backup/tarsnap.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix
index b34aa3ff50d..9e1db23ca22 100644
--- a/nixos/modules/services/backup/tarsnap.nix
+++ b/nixos/modules/services/backup/tarsnap.nix
@@ -32,6 +32,8 @@ in
     services.tarsnap = {
       enable = mkEnableOption (lib.mdDoc "periodic tarsnap backups");
 
+      package = mkPackageOption pkgs "tarsnap" { };
+
       keyfile = mkOption {
         type = types.str;
         default = "/root/tarsnap.key";
@@ -307,7 +309,7 @@ in
         requires    = [ "network-online.target" ];
         after       = [ "network-online.target" ];
 
-        path = with pkgs; [ iputils tarsnap util-linux ];
+        path = with pkgs; [ iputils gcfg.package util-linux ];
 
         # In order for the persistent tarsnap timer to work reliably, we have to
         # make sure that the tarsnap server is reachable after systemd starts up
@@ -318,7 +320,7 @@ in
         '';
 
         script = let
-          tarsnap = ''tarsnap --configfile "/etc/tarsnap/${name}.conf"'';
+          tarsnap = ''${lib.getExe gcfg.package} --configfile "/etc/tarsnap/${name}.conf"'';
           run = ''${tarsnap} -c -f "${name}-$(date +"%Y%m%d%H%M%S")" \
                         ${optionalString cfg.verbose "-v"} \
                         ${optionalString cfg.explicitSymlinks "-H"} \
@@ -355,10 +357,10 @@ in
         description = "Tarsnap restore '${name}'";
         requires    = [ "network-online.target" ];
 
-        path = with pkgs; [ iputils tarsnap util-linux ];
+        path = with pkgs; [ iputils gcfg.package util-linux ];
 
         script = let
-          tarsnap = ''tarsnap --configfile "/etc/tarsnap/${name}.conf"'';
+          tarsnap = ''${lib.getExe gcfg.package} --configfile "/etc/tarsnap/${name}.conf"'';
           lastArchive = "$(${tarsnap} --list-archives | sort | tail -1)";
           run = ''${tarsnap} -x -f "${lastArchive}" ${optionalString cfg.verbose "-v"}'';
           cachedir = escapeShellArg cfg.cachedir;
@@ -402,6 +404,6 @@ in
         { text = configFile name cfg;
         }) gcfg.archives;
 
-    environment.systemPackages = [ pkgs.tarsnap ];
+    environment.systemPackages = [ gcfg.package ];
   };
 }