From 38860e25ea17f81878efe496fccfd23de16dff56 Mon Sep 17 00:00:00 2001 From: uakci Date: Wed, 15 Sep 2021 01:32:27 +0200 Subject: preliminary nixos module --- module.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 module.nix (limited to 'module.nix') 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; + }; + }; + }; +} -- cgit v1.2.3