summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/ngircd.nix
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-03-19 22:04:35 -0400
committerShea Levy <shea@shealevy.com>2014-03-19 22:04:35 -0400
commit78e6d0143dd672d8d1645c648da058461572e3e1 (patch)
treea731ee39bb92bc2d4de3c5bf6382750a5f76d6d4 /nixos/modules/services/networking/ngircd.nix
parent608f436da3c6d526af8fce92bc6898e99beb319e (diff)
Add ngircd module
Diffstat (limited to 'nixos/modules/services/networking/ngircd.nix')
-rw-r--r--nixos/modules/services/networking/ngircd.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/ngircd.nix b/nixos/modules/services/networking/ngircd.nix
new file mode 100644
index 000000000000..49e5f3559803
--- /dev/null
+++ b/nixos/modules/services/networking/ngircd.nix
@@ -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.";
+ };
+ };
+}