summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruakci <uakci@uakci.pl>2021-09-20 15:35:24 +0200
committeruakci <uakci@uakci.pl>2021-09-20 15:35:24 +0200
commit620be7928c4112dd2dd98c571993df3b9fda9ffa (patch)
tree10a552d017122f2ee6a665fcedf2159fbe6806df
parentcorrected service defs (diff)
downloadnuogai-620be7928c4112dd2dd98c571993df3b9fda9ffa.tar.gz
nuogai-620be7928c4112dd2dd98c571993df3b9fda9ffa.zip
ditto
-rw-r--r--module.nix19
1 files 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}}";