mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-29 12:37:26 +00:00
nixos/duplicati: Add dataDir to service
Other services such as minecraft-server and plex allow configuration of the dataDir option, allowing the files stored by each service to be in a custom location. Co-authored-by: Aaron Andersen <aaron@fosslib.net>
This commit is contained in:
parent
9c49aab2d2
commit
c7008f8fdf
3 changed files with 35 additions and 9 deletions
|
@ -253,6 +253,13 @@
|
||||||
configuration.
|
configuration.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</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>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -101,3 +101,5 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
e.g. Wayland.
|
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 `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 {
|
interface = mkOption {
|
||||||
default = "127.0.0.1";
|
default = "127.0.0.1";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
|
@ -45,20 +59,23 @@ in
|
||||||
description = "Duplicati backup";
|
description = "Duplicati backup";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = mkMerge [
|
||||||
User = cfg.user;
|
{
|
||||||
Group = "duplicati";
|
User = cfg.user;
|
||||||
StateDirectory = "duplicati";
|
Group = "duplicati";
|
||||||
ExecStart = "${pkgs.duplicati}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=/var/lib/duplicati";
|
ExecStart = "${pkgs.duplicati}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=${cfg.dataDir}";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
};
|
}
|
||||||
|
(mkIf (cfg.dataDir == "/var/lib/duplicati") {
|
||||||
|
StateDirectory = "duplicati";
|
||||||
|
})
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
users.users = lib.optionalAttrs (cfg.user == "duplicati") {
|
users.users = lib.optionalAttrs (cfg.user == "duplicati") {
|
||||||
duplicati = {
|
duplicati = {
|
||||||
uid = config.ids.uids.duplicati;
|
uid = config.ids.uids.duplicati;
|
||||||
home = "/var/lib/duplicati";
|
home = cfg.dataDir;
|
||||||
createHome = true;
|
|
||||||
group = "duplicati";
|
group = "duplicati";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue