summary refs log tree commit diff
path: root/nixos/modules/services/backup
diff options
context:
space:
mode:
authorJanet Cobb <jason.e.cobb@gmail.com>2023-03-19 01:34:01 -0400
committerJanet Cobb <jason.e.cobb@gmail.com>2023-03-29 17:23:51 -0400
commit1033d0f6ac13b7a948090252a2d4386a08deb5b8 (patch)
tree79b173e7560f54b47f19d6df73b105b4ab8180b3 /nixos/modules/services/backup
parentb573a7f69484a7d213680abb70b4f95bdc28eee5 (diff)
downloadnixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.tar
nixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.tar.gz
nixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.tar.bz2
nixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.tar.lz
nixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.tar.xz
nixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.tar.zst
nixpkgs-1033d0f6ac13b7a948090252a2d4386a08deb5b8.zip
(nixos/sanoid, nixos/syncoid): Add package options
Allows changing the sanoid package to be used for these services.
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r--nixos/modules/services/backup/sanoid.nix4
-rw-r--r--nixos/modules/services/backup/syncoid.nix4
2 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/services/backup/sanoid.nix b/nixos/modules/services/backup/sanoid.nix
index a51708170fb..aae77cee07d 100644
--- a/nixos/modules/services/backup/sanoid.nix
+++ b/nixos/modules/services/backup/sanoid.nix
@@ -114,6 +114,8 @@ in
   options.services.sanoid = {
     enable = mkEnableOption (lib.mdDoc "Sanoid ZFS snapshotting service");
 
+    package = lib.mkPackageOptionMD pkgs "sanoid" {};
+
     interval = mkOption {
       type = types.str;
       default = "hourly";
@@ -181,7 +183,7 @@ in
         ExecStartPre = (map (buildAllowCommand "allow" [ "snapshot" "mount" "destroy" ]) datasets);
         ExecStopPost = (map (buildAllowCommand "unallow" [ "snapshot" "mount" "destroy" ]) datasets);
         ExecStart = lib.escapeShellArgs ([
-          "${pkgs.sanoid}/bin/sanoid"
+          "${cfg.package}/bin/sanoid"
           "--cron"
           "--configdir"
           (pkgs.writeTextDir "sanoid.conf" configFile)
diff --git a/nixos/modules/services/backup/syncoid.nix b/nixos/modules/services/backup/syncoid.nix
index 6188f109463..0f375455e7e 100644
--- a/nixos/modules/services/backup/syncoid.nix
+++ b/nixos/modules/services/backup/syncoid.nix
@@ -87,6 +87,8 @@ in
   options.services.syncoid = {
     enable = mkEnableOption (lib.mdDoc "Syncoid ZFS synchronization service");
 
+    package = lib.mkPackageOptionMD pkgs "sanoid" {};
+
     interval = mkOption {
       type = types.str;
       default = "hourly";
@@ -331,7 +333,7 @@ in
               ExecStopPost =
                 (map (buildUnallowCommand c.localSourceAllow) (localDatasetName c.source)) ++
                 (map (buildUnallowCommand c.localTargetAllow) (localDatasetName c.target));
-              ExecStart = lib.escapeShellArgs ([ "${pkgs.sanoid}/bin/syncoid" ]
+              ExecStart = lib.escapeShellArgs ([ "${cfg.package}/bin/syncoid" ]
                 ++ optionals c.useCommonArgs cfg.commonArgs
                 ++ optional c.recursive "-r"
                 ++ optionals (c.sshKey != null) [ "--sshkey" c.sshKey ]