3
0
Fork 0
forked from mirrors/nixpkgs

duplicati: create service

This commit is contained in:
nyanloutre 2018-04-07 21:23:04 +02:00
parent 20f18c7d16
commit b3aa9ecdf8
No known key found for this signature in database
GPG key ID: F85D93686A3A9063
3 changed files with 43 additions and 0 deletions

View file

@ -305,6 +305,7 @@
hass = 286; hass = 286;
monero = 287; monero = 287;
ceph = 288; ceph = 288;
duplicati = 289;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399! # 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; hass = 286;
monero = 287; monero = 287;
ceph = 288; ceph = 288;
duplicati = 289;
# When adding a gid, make sure it doesn't match an existing # When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal # uid. Users and groups with the same name should have equal

View file

@ -159,6 +159,7 @@
./services/audio/ympd.nix ./services/audio/ympd.nix
./services/backup/bacula.nix ./services/backup/bacula.nix
./services/backup/borgbackup.nix ./services/backup/borgbackup.nix
./services/backup/duplicati.nix
./services/backup/crashplan.nix ./services/backup/crashplan.nix
./services/backup/crashplan-small-business.nix ./services/backup/crashplan-small-business.nix
./services/backup/mysql-backup.nix ./services/backup/mysql-backup.nix

View file

@ -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;
};
}