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