diff options
author | Sandro <sandro.jaeckel@gmail.com> | 2023-07-24 00:46:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-24 00:46:24 +0200 |
commit | 9ca0bd9db35fee3473dec48dbb163de7100e0455 (patch) | |
tree | ce11dcd2bd77a3e13d1e5e9a26afba444c1ca746 /nixos/modules/services/backup | |
parent | c935eeeca31d27a0a742442cdeba9b43f98ede5e (diff) | |
parent | a936b9edec45591e04dd2caa79cb87b6e87c8619 (diff) |
Merge pull request #244467 from wamserma/tarsnap-add-package-option
tarsnap: add package option
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r-- | nixos/modules/services/backup/tarsnap.nix | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/nixos/modules/services/backup/tarsnap.nix b/nixos/modules/services/backup/tarsnap.nix index b34aa3ff50dda..9e1db23ca22a7 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 ]; }; } |