diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
index 1e425248be0f..4a68bc941860 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
@@ -253,6 +253,13 @@
configuration.
+
+
+ The option services.duplicati.dataDir has
+ been added to allow changing the location of duplicati’s
+ files.
+
+
diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md
index ca89732fa801..556552723100 100644
--- a/nixos/doc/manual/release-notes/rl-2205.section.md
+++ b/nixos/doc/manual/release-notes/rl-2205.section.md
@@ -101,3 +101,5 @@ In addition to numerous new and upgraded packages, this release has the followin
e.g. Wayland.
- The `services.stubby` module was converted to a [settings-style](https://github.com/NixOS/rfcs/blob/master/rfcs/0042-config-option.md) configuration.
+
+- The option `services.duplicati.dataDir` has been added to allow changing the location of duplicati's files.
diff --git a/nixos/modules/services/backup/duplicati.nix b/nixos/modules/services/backup/duplicati.nix
index cf5aebdecd28..97864c44691b 100644
--- a/nixos/modules/services/backup/duplicati.nix
+++ b/nixos/modules/services/backup/duplicati.nix
@@ -18,6 +18,20 @@ in
'';
};
+ dataDir = mkOption {
+ type = types.str;
+ default = "/var/lib/duplicati";
+ description = ''
+ The directory where Duplicati stores its data files.
+
+
+ If left as the default value this directory will automatically be created
+ before the Duplicati server starts, otherwise you are responsible for ensuring
+ the directory exists with appropriate ownership and permissions.
+
+ '';
+ };
+
interface = mkOption {
default = "127.0.0.1";
type = types.str;
@@ -45,20 +59,23 @@ in
description = "Duplicati backup";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- User = cfg.user;
- Group = "duplicati";
- StateDirectory = "duplicati";
- ExecStart = "${pkgs.duplicati}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=/var/lib/duplicati";
- Restart = "on-failure";
- };
+ serviceConfig = mkMerge [
+ {
+ User = cfg.user;
+ Group = "duplicati";
+ ExecStart = "${pkgs.duplicati}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=${cfg.dataDir}";
+ Restart = "on-failure";
+ }
+ (mkIf (cfg.dataDir == "/var/lib/duplicati") {
+ StateDirectory = "duplicati";
+ })
+ ];
};
users.users = lib.optionalAttrs (cfg.user == "duplicati") {
duplicati = {
uid = config.ids.uids.duplicati;
- home = "/var/lib/duplicati";
- createHome = true;
+ home = cfg.dataDir;
group = "duplicati";
};
};