blob: ec48bcb7a7f69dd8a625fe7f55e2f4c857ea981a (
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
|
{
config,
lib,
pkgs,
...
}: let
cfg = config.services.guzzle-api;
inherit (lib) mkDefault mkEnableOption mkOption mkIf types;
in {
options.services.guzzle-api = {
enable = mkEnableOption "enable guzzle-api";
url = mkOption {
type = types.str;
default = "";
description = "url string for guzzle-api";
};
port = mkOption {
type = types.str;
default = "8080";
description = "port for guzzle-api";
};
};
config.systemd.services = mkIf cfg.enable {
guzzle-api = {
enable = mkDefault true;
wantedBy = ["multi-user.target"];
after = ["network.target"];
script = ''
URL=${cfg.url} ${pkgs.guzzle-api-server}/bin/guzzle-api-server --host 0.0.0.0 --port "${cfg.port}"
'';
serviceConfig = mkDefault {
Restart = "always";
Type = "simple";
};
};
};
}
|