feat(42/irc): setup the irc server service

This commit is contained in:
Raphael 2025-06-22 18:34:40 +02:00
parent dc68443661
commit a1bc1e4074
5 changed files with 75 additions and 2 deletions

View file

@ -57,6 +57,7 @@
programs = { programs = {
zsh.enable = true; zsh.enable = true;
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
bat bat
cairo cairo

View file

@ -5,6 +5,7 @@
../global.nix ../global.nix
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/games/global.nix ../../modules/games/global.nix
../../services/forty_two.nix
../../services/discord.nix ../../services/discord.nix
../../services/games.nix ../../services/games.nix
../../services/web.nix ../../services/web.nix
@ -18,6 +19,7 @@
}; };
service = { service = {
forty_two.irc = true;
web.portefolio = true; web.portefolio = true;
minecraft = { minecraft = {
enium-pv = false; enium-pv = false;

View file

@ -21,8 +21,12 @@ in
}; };
systemd.services.yagpdb = { systemd.services.yagpdb = {
description = "Enium discord master bot"; description = "Enium discord master bot";
after = [ "network.target" ]; after = [
wantedBy = [ "multi-user.target" ]; "network.target"
];
wantedBy = [
"multi-user.target"
];
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
User = "dsc_master"; User = "dsc_master";

21
services/forty_two.nix Normal file
View file

@ -0,0 +1,21 @@
{ config, pkgs, lib, ... }:
let
irc = import ./forty_two/irc.nix {
inherit config pkgs lib;
};
cfg = config.service.forty_two;
in
{
imports = [
irc
];
options.service.forty_two = {
irc = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable the ft_irc server";
};
};
}

View file

@ -0,0 +1,45 @@
{ config, pkgs, lib, ... }:
let
cfg = config.service.forty_two.irc;
in
{
config = lib.mkIf cfg {
environment.systemPackages = with pkgs; [
llvmPackages.clang
llvmPackages.clang-tools
gnumake
];
users = {
groups.ft_irc = {
name = "ft_irc";
};
users.ft_irc = {
description = "Utilisateur the ft_irc server";
group = "ft_irc";
home = "/opt/irc/";
isSystemUser = true;
};
};
systemd.services.ft_irc = {
description = "Upload our irc on my own server";
after = [
"network.target"
];
wantedBy = [
"multi-user.target"
];
serviceConfig = {
Type = "simple";
User = "ft_irc";
WorkingDirectory = "/opt/irc";
ExecStartPre = "${pkgs.git}/bin/git pull";
ExecStart = "/opt/irc/ircserv 4243 irc";
Restart = "on-failure";
RestartSec = 30;
RemainAfterExit = false;
};
};
};
}