2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.ngircd;
|
|
|
|
|
|
|
|
configFile = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "ngircd.conf";
|
|
|
|
|
|
|
|
text = cfg.config;
|
|
|
|
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
echo -n "$text" > $out
|
|
|
|
${cfg.package}/sbin/ngircd --config $out --configtest
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.ngircd = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "the ngircd IRC server");
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
config = mkOption {
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc "The ngircd configuration (see ngircd.conf(5)).";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
type = types.lines;
|
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
package = mkPackageOption pkgs "ngircd" { };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
#!!! TODO: Use ExecReload (see https://github.com/NixOS/nixpkgs/issues/1988)
|
|
|
|
systemd.services.ngircd = {
|
|
|
|
description = "The ngircd IRC server";
|
|
|
|
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig.ExecStart = "${cfg.package}/sbin/ngircd --config ${configFile} --nodaemon";
|
|
|
|
|
|
|
|
serviceConfig.User = "ngircd";
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.ngircd = {
|
2021-09-18 10:52:07 +00:00
|
|
|
isSystemUser = true;
|
|
|
|
group = "ngircd";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "ngircd user.";
|
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
users.groups.ngircd = {};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|