about summary refs log tree commit diff
path: root/nixpkgs/nixos/modules/services/networking/dae.nix
blob: 231c555b330307ed01beffe1eb9810fb78b0aeba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{ config, pkgs, lib, ... }:
let
  cfg = config.services.dae;
in
{
  meta.maintainers = with lib.maintainers; [ pokon548 ];

  options = {
    services.dae = {
      enable = lib.options.mkEnableOption (lib.mdDoc "the dae service");
      package = lib.mkPackageOptionMD pkgs "dae" { };
    };
  };

  config = lib.mkIf config.services.dae.enable {
    networking.firewall.allowedTCPPorts = [ 12345 ];
    networking.firewall.allowedUDPPorts = [ 12345 ];

    systemd.services.dae = {
      unitConfig = {
        Description = "dae Service";
        Documentation = "https://github.com/daeuniverse/dae";
        After = [ "network-online.target" "systemd-sysctl.service" ];
        Wants = [ "network-online.target" ];
      };

      serviceConfig = {
        User = "root";
        ExecStartPre = "${lib.getExe cfg.package} validate -c /etc/dae/config.dae";
        ExecStart = "${lib.getExe cfg.package} run --disable-timestamp -c /etc/dae/config.dae";
        ExecReload = "${lib.getExe cfg.package} reload $MAINPID";
        LimitNPROC = 512;
        LimitNOFILE = 1048576;
        Restart = "on-abnormal";
        Type = "notify";
      };

      wantedBy = [ "multi-user.target" ];
    };
  };
}