feat: adding the configuration for discord bots
This commit is contained in:
parent
7d2608a6e8
commit
852eab5386
7 changed files with 130 additions and 46 deletions
|
|
@ -1,11 +1,20 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
../global.nix
|
../global.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
../../services/discord.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
service = {
|
||||||
|
bot_discord = {
|
||||||
|
master = true;
|
||||||
|
music = true;
|
||||||
|
tempvoc = true;
|
||||||
|
ticket = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
# Bootloader.
|
# Bootloader.
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
systemd-boot.enable = true;
|
systemd-boot.enable = true;
|
||||||
|
|
@ -19,37 +28,6 @@
|
||||||
wireless.enable = false;
|
wireless.enable = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services = {
|
|
||||||
music = {
|
|
||||||
description = "Enium discord bot for music";
|
|
||||||
after = [ "network.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
User = "nobody";
|
|
||||||
WorkingDirectory = "/root/music";
|
|
||||||
ExecStart = "${pkgs.nodejs}/bin/npm start";
|
|
||||||
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = 5;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
yagpdb = {
|
|
||||||
description = "Enium discord master bot";
|
|
||||||
after = [ "network.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "simple";
|
|
||||||
User = "nobody";
|
|
||||||
WorkingDirectory = "/root/yagpdb/cmd/yagpdb";
|
|
||||||
ExecStart = "/root/yagpdb/cmd/yagpdb/yagpdb -all -pa";
|
|
||||||
EnvironmentFile = "/root/yagpdb/cmd/yagpdb/sampleenvfile";
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = 5;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
steam = {
|
steam = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@
|
||||||
dconf
|
dconf
|
||||||
fastfetch
|
fastfetch
|
||||||
git
|
git
|
||||||
go
|
|
||||||
home-manager
|
home-manager
|
||||||
lego
|
lego
|
||||||
libjpeg
|
libjpeg
|
||||||
|
|
|
||||||
26
services/bot_discord/master.nix
Normal file
26
services/bot_discord/master.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
26
services/bot_discord/music.nix
Normal file
26
services/bot_discord/music.nix
Normal 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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -1,18 +1,21 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.service.bot_discord.tempvoc;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
config = lib.mkIf cfg {
|
||||||
nodejs
|
environment.systemPackages = with pkgs; [
|
||||||
];
|
nodejs
|
||||||
systemd.services.ticket = {
|
];
|
||||||
tempvoc = {
|
systemd.services.tempvoc = {
|
||||||
description = "Enium discord bot for tempvoc";
|
description = "Enium discord bot for tempvoc";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "nobody";
|
User = "nobody";
|
||||||
WorkingDirectory = "/root/tempvoc";
|
WorkingDirectory = "/opt/tempvoc";
|
||||||
ExecStart = "${pkgs.nodejs}/bin/npm start";
|
ExecStart = "${pkgs.nodejs}/bin/npm start";
|
||||||
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
|
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.service.bot_discord.ticket;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
environment.systemPackages = with pkgs; [
|
config = lib.mkIf cfg {
|
||||||
nodejs
|
environment.systemPackages = with pkgs; [
|
||||||
];
|
nodejs
|
||||||
systemd.services.ticket = {
|
];
|
||||||
|
systemd.services.ticket = {
|
||||||
description = "Service for ticket";
|
description = "Service for ticket";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "nobody";
|
User = "nobody";
|
||||||
WorkingDirectory = "/root/ticket";
|
WorkingDirectory = "/opt/ticket";
|
||||||
ExecStart = "${pkgs.nodejs}/bin/npm start";
|
ExecStart = "${pkgs.nodejs}/bin/npm start";
|
||||||
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
|
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
|
||||||
48
services/discord.nix
Normal file
48
services/discord.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
master_bot = import ./bot_discord/master.nix {
|
||||||
|
inherit config pkgs lib;
|
||||||
|
};
|
||||||
|
music_bot = import ./bot_discord/music.nix {
|
||||||
|
inherit config pkgs lib;
|
||||||
|
};
|
||||||
|
tempvoc_bot = import ./bot_discord/tempvoc.nix {
|
||||||
|
inherit config pkgs lib;
|
||||||
|
};
|
||||||
|
ticket_bot = import ./bot_discord/ticket.nix {
|
||||||
|
inherit config pkgs lib;
|
||||||
|
};
|
||||||
|
cfg = config.service.bot_discord;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
master_bot
|
||||||
|
music_bot
|
||||||
|
tempvoc_bot
|
||||||
|
ticket_bot
|
||||||
|
];
|
||||||
|
|
||||||
|
options.service.bot_discord = {
|
||||||
|
master = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable master bot";
|
||||||
|
};
|
||||||
|
music = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable music bot";
|
||||||
|
};
|
||||||
|
tempvoc = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable tempvoc bot";
|
||||||
|
};
|
||||||
|
ticket = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable ticket bot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue