summary refs log tree commit diff
path: root/nixos/modules/services/misc/duckling.nix
blob: 77d2a92380b09efbc5c388418345d0a884c1e636 (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
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.duckling;
in {
  options = {
    services.duckling = {
      enable = mkEnableOption "duckling";

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

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

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

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