modules: charybdis -> solanum

This commit is contained in:
lassulus 2021-05-18 23:59:41 +02:00
parent f1c47ae668
commit 08cf800cca
3 changed files with 25 additions and 27 deletions

View File

@ -5,9 +5,9 @@
6667 6669 6667 6669
]; ];
systemd.services.charybdis.serviceConfig.LimitNOFILE = 16384; systemd.services.solanum.serviceConfig.LimitNOFILE = 16384;
krebs.charybdis = { krebs.solanum = {
enable = true; enable = true;
motd = '' motd = ''
hello hello

View File

@ -17,7 +17,6 @@ let
./buildbot/slave.nix ./buildbot/slave.nix
./build.nix ./build.nix
./cachecache.nix ./cachecache.nix
./charybdis.nix
./ci.nix ./ci.nix
./current.nix ./current.nix
./dns.nix ./dns.nix
@ -52,6 +51,7 @@ let
./secret.nix ./secret.nix
./setuid.nix ./setuid.nix
./shadow.nix ./shadow.nix
./solanum.nix
./sync-containers.nix ./sync-containers.nix
./tinc.nix ./tinc.nix
./tinc_graphs.nix ./tinc_graphs.nix

View File

@ -2,10 +2,10 @@
let let
inherit (lib) mkEnableOption mkIf mkOption singleton types; inherit (lib) mkEnableOption mkIf mkOption singleton types;
inherit (pkgs) coreutils charybdis; inherit (pkgs) coreutils solanum;
cfg = config.krebs.charybdis; cfg = config.krebs.solanum;
configFile = pkgs.writeText "charybdis.conf" '' configFile = pkgs.writeText "solanum.conf" ''
${cfg.config} ${cfg.config}
''; '';
in in
@ -16,22 +16,22 @@ in
options = { options = {
krebs.charybdis = { krebs.solanum = {
enable = mkEnableOption "Charybdis IRC daemon"; enable = mkEnableOption "Solanum IRC daemon";
config = mkOption { config = mkOption {
type = types.str; type = types.str;
description = '' description = ''
Charybdis IRC daemon configuration file. Solanum IRC daemon configuration file.
''; '';
}; };
statedir = mkOption { statedir = mkOption {
type = types.str; type = types.path;
default = "/var/lib/charybdis"; default = "/var/lib/solanum";
description = '' description = ''
Location of the state directory of charybdis. Location of the state directory of solanum.
''; '';
}; };
@ -39,7 +39,7 @@ in
type = types.str; type = types.str;
default = "ircd"; default = "ircd";
description = '' description = ''
Charybdis IRC daemon user. Solanum IRC daemon user.
''; '';
}; };
@ -47,7 +47,7 @@ in
type = types.str; type = types.str;
default = "ircd"; default = "ircd";
description = '' description = ''
Charybdis IRC daemon group. Solanum IRC daemon group.
''; '';
}; };
@ -55,9 +55,9 @@ in
type = types.nullOr types.lines; type = types.nullOr types.lines;
default = null; default = null;
description = '' description = ''
Charybdis MOTD text. Solanum MOTD text.
Charybdis will read its MOTD from /etc/charybdis/ircd.motd . Solanum will read its MOTD from /etc/solanum/ircd.motd .
If set, the value of this option will be written to this path. If set, the value of this option will be written to this path.
''; '';
}; };
@ -72,38 +72,36 @@ in
config = mkIf cfg.enable (lib.mkMerge [ config = mkIf cfg.enable (lib.mkMerge [
{ {
users.users.${cfg.user} = { users.users.${cfg.user} = {
description = "Charybdis IRC daemon user"; description = "Solanum IRC daemon user";
uid = config.ids.uids.ircd; uid = config.ids.uids.ircd;
group = cfg.group; group = cfg.group;
}; };
users.groups.${cfg.group} = { users.groups.${cfg.group} = {
name = cfg.group;
gid = config.ids.gids.ircd; gid = config.ids.gids.ircd;
}; };
systemd.services.charybdis = { systemd.tmpfiles.rules = [
description = "Charybdis IRC daemon"; "d ${cfg.statedir} - ${cfg.user} ${cfg.group} - -"
];
systemd.services.solanum = {
description = "Solanum IRC daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment = { environment = {
BANDB_DBPATH = "${cfg.statedir}/ban.db"; BANDB_DBPATH = "${cfg.statedir}/ban.db";
}; };
serviceConfig = { serviceConfig = {
ExecStart = "${charybdis}/bin/charybdis -foreground -logfile /dev/stdout -configfile ${configFile}"; ExecStart = "${solanum}/bin/solanum -foreground -logfile /dev/stdout -configfile ${configFile} -pidfile ${cfg.statedir}/ircd.pid";
Group = cfg.group; Group = cfg.group;
User = cfg.user; User = cfg.user;
PermissionsStartOnly = true; # preStart needs to run with root permissions
}; };
preStart = ''
${coreutils}/bin/mkdir -p ${cfg.statedir}
${coreutils}/bin/chown ${cfg.user}:${cfg.group} ${cfg.statedir}
'';
}; };
} }
(mkIf (cfg.motd != null) { (mkIf (cfg.motd != null) {
environment.etc."charybdis/ircd.motd".text = cfg.motd; environment.etc."solanum/ircd.motd".text = cfg.motd;
}) })
]); ]);
} }