diff options
| author | uakci <uakci@uakci.pl> | 2021-09-15 01:32:27 +0200 |
|---|---|---|
| committer | uakci <uakci@uakci.pl> | 2021-09-15 01:48:35 +0200 |
| commit | 38860e25ea17f81878efe496fccfd23de16dff56 (patch) | |
| tree | 71791a121ba10365e39e1bcb4ddd0b551a2d6a5e /module.nix | |
| parent | initial (diff) | |
| download | nuogai-38860e25ea17f81878efe496fccfd23de16dff56.tar.gz nuogai-38860e25ea17f81878efe496fccfd23de16dff56.zip | |
preliminary nixos module
Diffstat (limited to '')
| -rw-r--r-- | module.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/module.nix b/module.nix new file mode 100644 index 0000000..eb3eae0 --- /dev/null +++ b/module.nix @@ -0,0 +1,32 @@ +{ config, lib, self, ... }: +let cfg = config.services.nuogai; in with lib; { + options.services.nuogai = { + enable = mkEnableOption "Enables the nuogaı Discord Bot"; + 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.ExecStart = "${self.packages.nuigui.${system}}/bin/nuigui"; + environment.PORT = cfg.nuiPort; + }; + serial-predicate-engine = { + serviceConfig.ExecStart = "${self.packages.serial-predicate-engine.${system}}/bin/serial-predicate-engine"; + environment.PORT = cfg.spePort; + }; + }; + }; +} |
