1 { config, pkgs, lib, ... }:
6 cfg = config.services.duplicati;
10 services.duplicati = {
11 enable = mkEnableOption "Duplicati";
13 package = mkPackageOption pkgs "duplicati" { };
19 Port serving the web interface
25 default = "/var/lib/duplicati";
27 The directory where Duplicati stores its data files.
30 If left as the default value this directory will automatically be created
31 before the Duplicati server starts, otherwise you are responsible for ensuring
32 the directory exists with appropriate ownership and permissions.
37 interface = mkOption {
38 default = "127.0.0.1";
41 Listening interface for the web UI
42 Set it to "any" to listen on all available interfaces
47 default = "duplicati";
50 Duplicati runs as it's own user. It will only be able to backup world-readable files.
51 Run as root with special care.
57 config = mkIf cfg.enable {
58 environment.systemPackages = [ cfg.package ];
60 systemd.services.duplicati = {
61 description = "Duplicati backup";
62 after = [ "network.target" ];
63 wantedBy = [ "multi-user.target" ];
64 serviceConfig = mkMerge [
68 ExecStart = "${cfg.package}/bin/duplicati-server --webservice-interface=${cfg.interface} --webservice-port=${toString cfg.port} --server-datafolder=${cfg.dataDir}";
69 Restart = "on-failure";
71 (mkIf (cfg.dataDir == "/var/lib/duplicati") {
72 StateDirectory = "duplicati";
77 users.users = lib.optionalAttrs (cfg.user == "duplicati") {
79 uid = config.ids.uids.duplicati;
84 users.groups.duplicati.gid = config.ids.gids.duplicati;