diff options
author | Ilan Joselevich <personal@ilanjoselevich.com> | 2023-03-30 23:33:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 23:33:53 +0300 |
commit | 003c2e395763e6e0a46ea1bd9283daf1fffa602f (patch) | |
tree | 1ef3eaa8f4b79db0301be73929afa1fab54884bb /nixos/modules/services/backup | |
parent | 30a8405fd4feff38345d132b23b8da349a7ce857 (diff) | |
parent | 1033d0f6ac13b7a948090252a2d4386a08deb5b8 (diff) |
Merge pull request #221964 from randomnetcat/sanoid-service-package
sanoid/syncoid: Add package options
Diffstat (limited to 'nixos/modules/services/backup')
-rw-r--r-- | nixos/modules/services/backup/sanoid.nix | 4 | ||||
-rw-r--r-- | nixos/modules/services/backup/syncoid.nix | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/nixos/modules/services/backup/sanoid.nix b/nixos/modules/services/backup/sanoid.nix index a51708170fbfd..aae77cee07d0f 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 6188f10946302..0f375455e7ed1 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 ] |