feat(discord/marty): adding marty to the configuration
This commit is contained in:
parent
efc4d193fd
commit
dc68443661
3 changed files with 57 additions and 0 deletions
47
services/bot_discord/marty.nix
Normal file
47
services/bot_discord/marty.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue