From 89120d940b50c07d61487b85460cff1064782eb1 Mon Sep 17 00:00:00 2001 From: Raphael Date: Sun, 29 Jun 2025 14:11:53 +0200 Subject: [PATCH] feat(discord/tut): added the discord tut --- hosts/server/configuration.nix | 3 ++- services/bot_discord/ada.nix | 2 +- services/bot_discord/bot_loc.nix | 39 ++++++++++++++++++++++++++++++++ services/discord.nix | 11 ++++++++- services/self_host/monitor.nix | 3 +++ 5 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 services/bot_discord/bot_loc.nix diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index 1c3dcc8..0ef987d 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -32,7 +32,8 @@ }; bot_discord = { master = true; - bde = true; + bde = false; + tut = true; marty = true; ada = true; music = false; diff --git a/services/bot_discord/ada.nix b/services/bot_discord/ada.nix index ea63ac6..b5e676c 100644 --- a/services/bot_discord/ada.nix +++ b/services/bot_discord/ada.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: let - cfg = config.service.bot_discord.bde; + cfg = config.service.bot_discord.ada; in { config = lib.mkIf cfg { diff --git a/services/bot_discord/bot_loc.nix b/services/bot_discord/bot_loc.nix new file mode 100644 index 0000000..a3f0a20 --- /dev/null +++ b/services/bot_discord/bot_loc.nix @@ -0,0 +1,39 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.service.bot_discord.tut; +in +{ + config = lib.mkIf cfg { + users = { + groups.dsc_loc = { + name = "dsc_loc"; + }; + users.dsc_loc = { + description = "Utilisateur pour le bot tut"; + group = "dsc_loc"; + home = "/opt/alerte_poste-master"; + isSystemUser = true; + }; + }; + + systemd.services.bot_loc = { + description = "loc discord bot public"; + after = [ + "network.target" + ]; + wantedBy = [ + "multi-user.target" + ]; + serviceConfig = { + Type = "simple"; + User = "dsc_loc"; + WorkingDirectory = "/opt/alerte_poste-master"; + ExecStart = "/opt/alerte_poste-master/.venv/bin/python /opt/alerte_poste-master/src/main.py"; + EnvironmentFile = "/opt/alerte_poste-master/.env"; + Restart = "on-failure"; + RestartSec = 5; + }; + }; + }; +} diff --git a/services/discord.nix b/services/discord.nix index b008f00..26fc1ad 100644 --- a/services/discord.nix +++ b/services/discord.nix @@ -13,6 +13,9 @@ let ada_bot = import ./bot_discord/ada.nix { inherit config pkgs lib; }; + tut_bot = import ./bot_discord/bot_loc.nix { + inherit config pkgs lib; + }; bde_bot = import ./bot_discord/bde.nix { inherit config pkgs lib; }; @@ -28,6 +31,7 @@ in imports = [ ada_bot bde_bot + tut_bot master_bot music_bot tempvoc_bot @@ -46,10 +50,15 @@ in default = false; description = "Enable ada bot"; }; + tut = lib.mkOption { + type = lib.types.bool; + default = false; + description = "enable tut bot"; + }; bde = lib.mkOption { type = lib.types.bool; default = false; - description = "Enable bde bot"; + description = "enable bde bot"; }; marty = lib.mkOption { type = lib.types.bool; diff --git a/services/self_host/monitor.nix b/services/self_host/monitor.nix index 927e944..85847b7 100644 --- a/services/self_host/monitor.nix +++ b/services/self_host/monitor.nix @@ -93,6 +93,9 @@ in targets = [ "https://raphael.parodi.pro" "https://nextcloud.enium.eu" + "https://htop.enium.eu" + "https://monitor.enium.eu" + "https://relance-pas-stp.me:4242" ]; }]; relabel_configs = [