summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/misc/duckling.nix
blob: 777dac70b1215dc2d31ef942ca4d1f27c2acfcd1 (plain)
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
42
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.services.duckling;
in
{
  options = {
    services.duckling = {
      enable = lib.mkEnableOption "duckling";

      port = lib.mkOption {
        type = lib.types.port;
        default = 8080;
        description = ''
          Port on which duckling will run.
        '';
      };
    };
  };

  config = lib.mkIf cfg.enable {
    systemd.services.duckling = {
      description = "Duckling server service";
      wantedBy = [ "multi-user.target" ];
      after = [ "network.target" ];

      environment = {
        PORT = toString cfg.port;
      };

      serviceConfig = {
        ExecStart = "${pkgs.haskellPackages.duckling}/bin/duckling-example-exe --no-access-log --no-error-log";
        Restart = "always";
        DynamicUser = true;
      };
    };
  };
}