diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index ea0c0d9159bf..94e3a0b2ebae 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2649,6 +2649,11 @@ github = "nthorne"; name = "Niklas Thörne"; }; + nyanloutre = { + email = "paul@nyanlout.re"; + github = "nyanloutre"; + name = "Paul Trehiou"; + }; nyarly = { email = "nyarly@gmail.com"; github = "nyarly"; diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix index c5dee2ca97af..3594f57595c7 100644 --- a/nixos/modules/misc/ids.nix +++ b/nixos/modules/misc/ids.nix @@ -305,6 +305,7 @@ hass = 286; monero = 287; ceph = 288; + duplicati = 289; # When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! @@ -578,6 +579,7 @@ hass = 286; monero = 287; ceph = 288; + duplicati = 289; # When adding a gid, make sure it doesn't match an existing # uid. Users and groups with the same name should have equal diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 46ec2022195f..2f9b1083ef1d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -160,6 +160,7 @@ ./services/audio/ympd.nix ./services/backup/bacula.nix ./services/backup/borgbackup.nix + ./services/backup/duplicati.nix ./services/backup/crashplan.nix ./services/backup/crashplan-small-business.nix ./services/backup/mysql-backup.nix diff --git a/nixos/modules/services/backup/duplicati.nix b/nixos/modules/services/backup/duplicati.nix new file mode 100644 index 000000000000..9772ca4d20a7 --- /dev/null +++ b/nixos/modules/services/backup/duplicati.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.services.duplicati; +in +{ + options = { + services.duplicati = { + enable = mkEnableOption "Duplicati"; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ pkgs.duplicati ]; + + systemd.services.duplicati = { + description = "Duplicati backup"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = "duplicati"; + Group = "duplicati"; + ExecStart = "${pkgs.duplicati}/bin/duplicati-server --webservice-interface=any --webservice-port=8200 --server-datafolder=/var/lib/duplicati"; + Restart = "on-failure"; + }; + }; + + users.extraUsers.duplicati = { + uid = config.ids.uids.duplicati; + home = "/var/lib/duplicati"; + createHome = true; + group = "duplicati"; + }; + users.extraGroups.duplicati.gid = config.ids.gids.duplicati; + + }; +} + diff --git a/pkgs/tools/backup/duplicati/default.nix b/pkgs/tools/backup/duplicati/default.nix new file mode 100644 index 000000000000..d36ef7ea64fb --- /dev/null +++ b/pkgs/tools/backup/duplicati/default.nix @@ -0,0 +1,37 @@ +{ stdenv, fetchzip, mono, sqlite, makeWrapper }: + +stdenv.mkDerivation rec { + name = "duplicati-${version}"; + version = "2.0.3.3"; + channel = "beta"; + build_date = "2018-04-02"; + + src = fetchzip { + url = "https://github.com/duplicati/duplicati/releases/download/v${version}-${version}_${channel}_${build_date}/duplicati-${version}_${channel}_${build_date}.zip"; + sha256 = "0hwdpsgrvm3gq648mg9g0z0rk49g71dd8r5i1a8w83pwdqv0hn9c"; + stripRoot = false; + }; + + buildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/{bin,share/${name}} + cp -r * $out/share/${name} + makeWrapper "${mono}/bin/mono" $out/bin/duplicati-cli \ + --add-flags "$out/share/${name}/Duplicati.CommandLine.exe" \ + --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ + sqlite ]} + makeWrapper "${mono}/bin/mono" $out/bin/duplicati-server \ + --add-flags "$out/share/${name}/Duplicati.Server.exe" \ + --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ + sqlite ]} + ''; + + meta = with stdenv.lib; { + description = "A free backup client that securely stores encrypted, incremental, compressed backups on cloud storage services and remote file servers"; + homepage = https://www.duplicati.com/; + license = licenses.lgpl21; + maintainers = with maintainers; [ nyanloutre ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 135cb001b59a..3b647595b7c6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2037,6 +2037,8 @@ with pkgs; duo-unix = callPackage ../tools/security/duo-unix { }; + duplicati = callPackage ../tools/backup/duplicati { }; + duplicity = callPackage ../tools/backup/duplicity { gnupg = gnupg1; };