feat(discord/marty): adding marty to the configuration

This commit is contained in:
Raphael 2025-06-15 14:51:12 +02:00
parent efc4d193fd
commit dc68443661
3 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,47 @@
{ config, pkgs, lib, ... }:
let
cfg = config.service.bot_discord.marty;
in
{
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nodejs
];
users = {
groups.dsc_marty = {
name = "dsc_marty";
};
users.dsc_marty = {
description = "Utilisateur pour le bot BDE";
group = "dsc_marty";
home = "/opt/marty";
isSystemUser = true;
};
};
systemd.services.bot_marty = {
description = "marty discord bot";
after = [
"network.target"
];
wantedBy = [
"multi-user.target"
];
serviceConfig = {
Type = "simple";
User = "dsc_marty";
WorkingDirectory = "/opt/marty";
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
ExecStartPre = [
"${pkgs.nodejs}/bin/npm install"
"${pkgs.nodejs}/bin/npm run build"
];
ExecStart = "${pkgs.nodejs}/bin/npm run start-prod";
EnvironmentFile = "/opt/marty/.env";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}

View file

@ -16,6 +16,9 @@ let
bde_bot = import ./bot_discord/bde.nix {
inherit config pkgs lib;
};
marty_bot = import ./bot_discord/marty.nix {
inherit config pkgs lib;
};
ticket_bot = import ./bot_discord/ticket.nix {
inherit config pkgs lib;
};
@ -29,6 +32,7 @@ in
music_bot
tempvoc_bot
ticket_bot
marty_bot
];
options.service.bot_discord = {
@ -47,6 +51,11 @@ in
default = false;
description = "Enable bde bot";
};
marty = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable marty bot";
};
music = lib.mkOption {
type = lib.types.bool;
default = false;