2014-03-20 03:04:35 +01: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 = {
|
|
|
|
enable = mkEnableOption "the ngircd IRC server";
|
|
|
|
|
|
|
|
config = mkOption {
|
|
|
|
description = "The ngircd configuration (see ngircd.conf(5)).";
|
|
|
|
|
|
|
|
type = types.lines;
|
|
|
|
};
|
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
description = "The ngircd package.";
|
|
|
|
|
|
|
|
type = types.package;
|
|
|
|
|
|
|
|
default = pkgs.ngircd;
|
2021-10-03 18:06:03 +02:00
|
|
|
defaultText = literalExpression "pkgs.ngircd";
|
2014-03-20 03:04:35 +01: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";
|
|
|
|
};
|
|
|
|
|
2018-06-30 01:58:35 +02:00
|
|
|
users.users.ngircd = {
|
2021-08-08 14:00:00 +02:00
|
|
|
isSystemUser = true;
|
|
|
|
group = "ngircd";
|
2014-03-20 03:04:35 +01:00
|
|
|
description = "ngircd user.";
|
|
|
|
};
|
2021-08-08 14:00:00 +02:00
|
|
|
users.groups.ngircd = {};
|
|
|
|
|
2014-03-20 03:04:35 +01:00
|
|
|
};
|
|
|
|
}
|