Merge pull request #152043 from Lyndeno/duplicati-dataDir
nixos/duplicati: Add dataDir to service
This commit is contained in:
commit
4ceea6850a
3 changed files with 35 additions and 9 deletions
|
@ -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>
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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";
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue