mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-11 21:06:19 +03:00
duplicati: create service
This commit is contained in:
parent
20f18c7d16
commit
b3aa9ecdf8
3 changed files with 43 additions and 0 deletions
40
nixos/modules/services/backup/duplicati.nix
Normal file
40
nixos/modules/services/backup/duplicati.nix
Normal 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;
|
||||
|
||||
};
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue