diff options
author | Aaron Andersen <aaron@fosslib.net> | 2021-12-29 15:05:01 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-29 15:05:01 -0500 |
commit | 4ceea6850a28fa3ad4d922f8676ba87c383f3d25 (patch) | |
tree | 5ac1dea3165c0788aa7fb6dab7002808abe89862 | |
parent | e964e7d04ae05eb371faa5635b8ad70c6a92270e (diff) | |
parent | c7008f8fdf49f1133c7d8d5524649d9ef239712d (diff) |
Merge pull request #152043 from Lyndeno/duplicati-dataDir
nixos/duplicati: Add dataDir to service
-rw-r--r-- | nixos/doc/manual/from_md/release-notes/rl-2205.section.xml | 7 | ||||
-rw-r--r-- | nixos/doc/manual/release-notes/rl-2205.section.md | 2 | ||||
-rw-r--r-- | nixos/modules/services/backup/duplicati.nix | 35 |
3 files changed, 35 insertions, 9 deletions
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. </para> </listitem> + <listitem> + <para> + The option <literal>services.duplicati.dataDir</literal> has + been added to allow changing the location of duplicati’s + files. + </para> + </listitem> </itemizedlist> </section> </section> 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. + + <note><para> + 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. + </para></note> + ''; + }; + 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"; }; }; |