3
0
Fork 0
forked from mirrors/nixpkgs

Add ngircd module

This commit is contained in:
Shea Levy 2014-03-19 22:04:35 -04:00
parent 608f436da3
commit 78e6d0143d
3 changed files with 60 additions and 0 deletions

View file

@ -120,6 +120,7 @@
jenkins = 109;
systemd-journal-gateway = 110;
notbit = 111;
ngircd = 112;
# When adding a uid, make sure it doesn't match an existing gid.

View file

@ -180,6 +180,7 @@
./services/networking/minidlna.nix
./services/networking/nat.nix
./services/networking/networkmanager.nix
./services/networking/ngircd.nix
./services/networking/notbit.nix
./services/networking/ntopng.nix
./services/networking/ntpd.nix

View file

@ -0,0 +1,58 @@
{ 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;
};
};
};
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.extraUsers.ngircd = {
uid = config.ids.uids.ngircd;
description = "ngircd user.";
};
};
}