feat: adding the configuration for discord bots

This commit is contained in:
Raphael 2025-02-02 23:43:31 +01:00
parent 7d2608a6e8
commit 852eab5386
7 changed files with 130 additions and 46 deletions

View file

@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
let
cfg = config.service.bot_discord.master;
in
{
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
go
];
systemd.services.yagpdb = {
description = "Enium discord master bot";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "nobody";
WorkingDirectory = "/opt/yagpdb/cmd/yagpdb";
ExecStart = "/opt/yagpdb/cmd/yagpdb/yagpdb -all -pa";
EnvironmentFile = "/opt/yagpdb/cmd/yagpdb/sampleenvfile";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}

View file

@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
let
cfg = config.service.bot_discord.music;
in
{
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nodejs
];
systemd.services.music = {
description = "Enium discord bot for music";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "nobody";
WorkingDirectory = "/opt/music";
ExecStart = "${pkgs.nodejs}/bin/npm start";
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}

View file

@ -1,18 +1,21 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
cfg = config.service.bot_discord.tempvoc;
in
{
environment.systemPackages = with pkgs; [
nodejs
];
systemd.services.ticket = {
tempvoc = {
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nodejs
];
systemd.services.tempvoc = {
description = "Enium discord bot for tempvoc";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "nobody";
WorkingDirectory = "/root/tempvoc";
WorkingDirectory = "/opt/tempvoc";
ExecStart = "${pkgs.nodejs}/bin/npm start";
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
Restart = "on-failure";

View file

@ -1,17 +1,21 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
cfg = config.service.bot_discord.ticket;
in
{
environment.systemPackages = with pkgs; [
nodejs
];
systemd.services.ticket = {
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nodejs
];
systemd.services.ticket = {
description = "Service for ticket";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "nobody";
WorkingDirectory = "/root/ticket";
WorkingDirectory = "/opt/ticket";
ExecStart = "${pkgs.nodejs}/bin/npm start";
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
Restart = "on-failure";