From ba8396e72b380e06e855bcf5eb98180fa51475b4 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 19 May 2025 00:31:42 +0200 Subject: [PATCH] feat(ada): adding a single user (trying to patch but python is not fun) --- services/bot_discord/ada.nix | 22 ++++++++++++++-------- services/bot_discord/bde.nix | 6 ------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/services/bot_discord/ada.nix b/services/bot_discord/ada.nix index 5710758..ea63ac6 100644 --- a/services/bot_discord/ada.nix +++ b/services/bot_discord/ada.nix @@ -5,9 +5,18 @@ let in { config = lib.mkIf cfg { - environment.systemPackages = with pkgs; [ - nix - ]; + users = { + groups.dsc_ada = { + name = "dsc_ada"; + }; + users.dsc_ada = { + description = "Utilisateur pour le bot Ada"; + group = "dsc_ada"; + home = "/opt/Ada"; + isSystemUser = true; + }; + }; + systemd.services.bot_ada = { description = "Ada (chdoe asso) discord bot public"; after = [ @@ -18,15 +27,12 @@ in ]; serviceConfig = { Type = "simple"; - User = "nobody"; + User = "dsc_ada"; WorkingDirectory = "/opt/Ada"; - ExecStart = "/opt/Ada/.venv/bin/python /opt/Ada/bot.py"; + ExecStart = "/opt/Ada/bot.py"; EnvironmentFile = "/opt/Ada/.env"; Restart = "on-failure"; RestartSec = 5; - Environment = lib.mkForce '' - Environment=PYTHONUNBUFFERED=1 - ''; }; }; }; diff --git a/services/bot_discord/bde.nix b/services/bot_discord/bde.nix index 23b52fc..893f289 100644 --- a/services/bot_discord/bde.nix +++ b/services/bot_discord/bde.nix @@ -5,9 +5,6 @@ let in { config = lib.mkIf cfg { - environment.systemPackages = with pkgs; [ - nix - ]; systemd.services.bot_bde = { description = "BDE discord bot public"; after = [ @@ -24,9 +21,6 @@ in EnvironmentFile = "/opt/Bot_Auth/.env"; Restart = "on-failure"; RestartSec = 5; - Environment = lib.mkForce '' - Environment=PYTHONUNBUFFERED=1 - ''; }; }; };