From 620be7928c4112dd2dd98c571993df3b9fda9ffa Mon Sep 17 00:00:00 2001 From: uakci Date: Mon, 20 Sep 2021 15:35:24 +0200 Subject: ditto --- module.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/module.nix b/module.nix index e837353..1c9353f 100644 --- a/module.nix +++ b/module.nix @@ -5,20 +5,25 @@ let cfg = config.services.nuogai; in with lib; { guilePackage = mkOption { default = pkgs.guile; type = types.package; }; nuiPort = mkOption { type = types.port; }; spePort = mkOption { type = types.port; }; + tokenPath = mkOption { type = types.path; }; }; 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" ]; - }) { + systemd.services = lib.mapAttrs (k: v: { + wants = [ "network-online.target" ]; + } // v) { nuogai = { + description = "Toaq Discord bot"; + wantedBy = [ "multi-user.target" ]; wants = [ "nuigui.service" "serial-predicate-engine.service" ]; - serviceConfig.ExecStart = "${self.packages.nuogai.${system}}/bin/nuogai"; environment = { - NUI_PORT = cfg.nuiPort; - SPE_PORT = cfg.spePort; + NUI_PORT = toString cfg.nuiPort; + SPE_PORT = toString cfg.spePort; }; + script = '' + export TOKEN=$(cat ${cfg.tokenPath}) + ${inputs.nuogai.packages.${system}.nuogai}/bin/nuogai + ''; }; nuigui = { serviceConfig.WorkingDirectory = "${self.packages.nuigui.${system}}"; -- cgit v1.2.3