1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8 cfg = config.services.duckling;
9in
10{
11 options = {
12 services.duckling = {
13 enable = lib.mkEnableOption "duckling";
14
15 port = lib.mkOption {
16 type = lib.types.port;
17 default = 8080;
18 description = ''
19 Port on which duckling will run.
20 '';
21 };
22 };
23 };
24
25 config = lib.mkIf cfg.enable {
26 systemd.services.duckling = {
27 description = "Duckling server service";
28 wantedBy = [ "multi-user.target" ];
29 after = [ "network.target" ];
30
31 environment = {
32 PORT = builtins.toString cfg.port;
33 };
34
35 serviceConfig = {
36 ExecStart = "${pkgs.haskellPackages.duckling}/bin/duckling-example-exe --no-access-log --no-error-log";
37 Restart = "always";
38 DynamicUser = true;
39 };
40 };
41 };
42}