blob: 4234e197d6c2d9ccd8a2910a6692260e2d5cfb9a (
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
43
|
{
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";
};
package = mkOption {
type = types.package;
default = pkgs.guzzle-api-server;
description = "package for guzzle-api wrapper";
};
};
config.systemd.services = mkIf cfg.enable {
guzzle-api = {
enable = mkDefault true;
wantedBy = ["multi-user.target"];
after = ["network.target"];
script = ''
URL=${cfg.url} ${cfg.package}/bin/guzzle-api-server --host 0.0.0.0 --port "${cfg.port}"
'';
serviceConfig = mkDefault {
Restart = "always";
Type = "simple";
};
};
};
}
|