aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/services/networking/ngircd.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/services/networking/ngircd.nix')
-rw-r--r--nixpkgs/nixos/modules/services/networking/ngircd.nix59
1 files changed, 59 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/networking/ngircd.nix b/nixpkgs/nixos/modules/services/networking/ngircd.nix
new file mode 100644
index 00000000000..4b2fa779592
--- /dev/null
+++ b/nixpkgs/nixos/modules/services/networking/ngircd.nix
@@ -0,0 +1,59 @@
+{ 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;
+ defaultText = "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.users.ngircd = {
+ uid = config.ids.uids.ngircd;
+ description = "ngircd user.";
+ };
+ };
+}