blob: e837353e8f57559f7b221d09ec49607bb644cc81 (
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
|
{ config, pkgs, lib, self, ... }:
let cfg = config.services.nuogai; in with lib; {
options.services.nuogai = {
enable = mkEnableOption "Enables the nuogaı Discord Bot";
guilePackage = mkOption { default = pkgs.guile; type = types.package; };
nuiPort = mkOption { type = types.port; };
spePort = mkOption { type = types.port; };
};
config = mkIf cfg.enable {
fonts.fonts = [ self.packages.toaqScript.${system} ];
systemd.services = lib.mapAttrs (k: v: v // {
wantedBy = [ "multi-user.target" ];
wants = v.wants or [] ++ [ "network-online.target" ];
}) {
nuogai = {
wants = [ "nuigui.service" "serial-predicate-engine.service" ];
serviceConfig.ExecStart = "${self.packages.nuogai.${system}}/bin/nuogai";
environment = {
NUI_PORT = cfg.nuiPort;
SPE_PORT = cfg.spePort;
};
};
nuigui = {
serviceConfig.WorkingDirectory = "${self.packages.nuigui.${system}}";
serviceConfig.ExecStart = "${cfg.guilePackage} ./web.scm";
environment.PORT = cfg.nuiPort;
};
serial-predicate-engine = {
serviceConfig.WorkingDirectory = "${self.packages.serial-predicate-engine.${system}}";
serviceConfig.ExecStart = "${cfg.guilePackage} ./web/webservice.scm";
environment.PORT = cfg.spePort;
};
};
};
}
|