mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-21 17:01:10 +03:00

After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
89 lines
2.3 KiB
Nix
89 lines
2.3 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.duplicati;
|
|
in
|
|
{
|
|
options = {
|
|
services.duplicati = {
|
|
enable = lib.mkEnableOption "Duplicati";
|
|
|
|
package = lib.mkPackageOption pkgs "duplicati" { };
|
|
|
|
port = lib.mkOption {
|
|
default = 8200;
|
|
type = lib.types.port;
|
|
description = ''
|
|
Port serving the web interface
|
|
'';
|
|
};
|
|
|
|
dataDir = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "/var/lib/duplicati";
|
|
description = ''
|
|
The directory where Duplicati stores its data files.
|
|
|
|
::: {.note}
|
|
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 = lib.mkOption {
|
|
default = "127.0.0.1";
|
|
type = lib.types.str;
|
|
description = ''
|
|
Listening interface for the web UI
|
|
Set it to "any" to listen on all available interfaces
|
|
'';
|
|
};
|
|
|
|
user = lib.mkOption {
|
|
default = "duplicati";
|
|
type = lib.types.str;
|
|
description = ''
|
|
Duplicati runs as it's own user. It will only be able to backup world-readable files.
|
|
Run as root with special care.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
systemd.services.duplicati = {
|
|
description = "Duplicati backup";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = lib.mkMerge [
|
|
{
|
|
User = cfg.user;
|
|
Group = "duplicati";
|
|
ExecStart = "${cfg.package}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=${cfg.dataDir}";
|
|
Restart = "on-failure";
|
|
}
|
|
(lib.mkIf (cfg.dataDir == "/var/lib/duplicati") {
|
|
StateDirectory = "duplicati";
|
|
})
|
|
];
|
|
};
|
|
|
|
users.users = lib.optionalAttrs (cfg.user == "duplicati") {
|
|
duplicati = {
|
|
uid = config.ids.uids.duplicati;
|
|
home = cfg.dataDir;
|
|
group = "duplicati";
|
|
};
|
|
};
|
|
users.groups.duplicati.gid = config.ids.gids.duplicati;
|
|
|
|
};
|
|
}
|