1
0
Fork 0
nix-configuration/modules/nixos/services/duplicacy-web/default.nix

51 lines
1.2 KiB
Nix
Raw Normal View History

{
pkgs,
config,
lib,
...
}:
2024-02-29 14:53:34 +00:00
let
cfg = config.aux.system.services.duplicacy-web;
2024-02-29 14:53:34 +00:00
in
2024-08-02 21:55:48 +00:00
{
options = {
aux.system.services.duplicacy-web = {
2024-08-02 21:55:48 +00:00
enable = lib.mkEnableOption "Enables duplicacy-web";
home = lib.mkOption {
2024-09-07 17:44:14 +00:00
default = "/var/lib/duplicacy-web";
2024-08-02 21:55:48 +00:00
type = lib.types.str;
description = "Environment where duplicacy-web stores its config files";
};
};
};
2024-02-29 14:53:34 +00:00
config = lib.mkIf cfg.enable {
2024-12-06 16:16:58 +00:00
environment.systemPackages = [ pkgs.Sapana.duplicacy-web ];
2024-02-29 14:53:34 +00:00
networking.firewall.allowedTCPPorts = [ 3875 ];
2024-02-29 14:53:34 +00:00
# Install systemd service.
systemd.services.duplicacy-web = {
enable = true;
wants = [ "network-online.target" ];
after = [
"syslog.target"
"network-online.target"
];
description = "Start the Duplicacy backup service and web UI";
serviceConfig = {
Type = "simple";
2024-12-06 16:16:58 +00:00
ExecStart = ''${pkgs.Sapana.duplicacy-web}/duplicacy-web'';
Restart = "on-failure";
RestartSec = 10;
KillMode = "process";
};
environment = {
HOME = cfg.home;
};
2024-09-07 17:44:14 +00:00
unitConfig.RequiresMountsFor = cfg.home;
};
};
2024-02-29 14:53:34 +00:00
}