feat(ada): adding a single user (trying to patch but python is not fun)

This commit is contained in:
Raphael 2025-05-19 00:31:42 +02:00
parent fe18a72369
commit ba8396e72b
2 changed files with 14 additions and 14 deletions

View file

@ -5,9 +5,18 @@ let
in in
{ {
config = lib.mkIf cfg { config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [ users = {
nix 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 = { systemd.services.bot_ada = {
description = "Ada (chdoe asso) discord bot public"; description = "Ada (chdoe asso) discord bot public";
after = [ after = [
@ -18,15 +27,12 @@ in
]; ];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
User = "nobody"; User = "dsc_ada";
WorkingDirectory = "/opt/Ada"; WorkingDirectory = "/opt/Ada";
ExecStart = "/opt/Ada/.venv/bin/python /opt/Ada/bot.py"; ExecStart = "/opt/Ada/bot.py";
EnvironmentFile = "/opt/Ada/.env"; EnvironmentFile = "/opt/Ada/.env";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 5; RestartSec = 5;
Environment = lib.mkForce ''
Environment=PYTHONUNBUFFERED=1
'';
}; };
}; };
}; };

View file

@ -5,9 +5,6 @@ let
in in
{ {
config = lib.mkIf cfg { config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nix
];
systemd.services.bot_bde = { systemd.services.bot_bde = {
description = "BDE discord bot public"; description = "BDE discord bot public";
after = [ after = [
@ -24,9 +21,6 @@ in
EnvironmentFile = "/opt/Bot_Auth/.env"; EnvironmentFile = "/opt/Bot_Auth/.env";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 5; RestartSec = 5;
Environment = lib.mkForce ''
Environment=PYTHONUNBUFFERED=1
'';
}; };
}; };
}; };