nixos/services/bot_discord/ticket.nix
2025-05-19 01:01:54 +02:00

37 lines
839 B
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.service.bot_discord.ticket;
in
{
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
nodejs
];
users = {
groups.dsc_ticket = {
name = "dsc_ticket";
};
users.dsc_ticket = {
description = "Utilisateur pour le bot ticket";
group = "dsc_ticket";
home = "/opt/ticket";
isSystemUser = true;
};
};
systemd.services.ticket = {
description = "Service for ticket";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
User = "dsc_ticket";
WorkingDirectory = "/opt/ticket";
ExecStart = "${pkgs.nodejs}/bin/npm start";
Environment = "PATH=${pkgs.coreutils}/bin:${pkgs.bash}/bin:${pkgs.nodejs}/bin";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}