Merge pull request #7788 from Lassulus/charybdis

add charybdis nixos module
This commit is contained in:
Arseniy Seroka 2015-05-11 12:57:58 +03:00
commit c0727fb751
6 changed files with 148 additions and 0 deletions

View File

@ -116,6 +116,7 @@
kovirobi = "Kovacsics Robert <kovirobi@gmail.com>";
kragniz = "Louis Taylor <kragniz@gmail.com>";
ktosiek = "Tomasz Kontusz <tomasz.kontusz@gmail.com>";
lassulus = "Lassulus <lassulus@gmail.com>";
lethalman = "Luca Bruno <lucabru@src.gnome.org>";
lhvwb = "Nathaniel Baxter <nathaniel.baxter@gmail.com>";
linquize = "Linquize <linquize@yahoo.com.hk>";

View File

@ -253,6 +253,7 @@
./services/networking/bind.nix
./services/networking/bitlbee.nix
./services/networking/btsync.nix
./services/networking/charybdis.nix
./services/networking/chrony.nix
./services/networking/cjdns.nix
./services/networking/cntlm.nix

View File

@ -0,0 +1,98 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkEnableOption mkIf mkOption singleton types;
inherit (pkgs) coreutils charybdis;
cfg = config.services.charybdis;
configFile = pkgs.writeText "charybdis.conf" ''
${cfg.config}
'';
in
{
###### interface
options = {
services.charybdis = {
enable = mkEnableOption "Charybdis IRC daemon";
config = mkOption {
type = types.string;
description = ''
Charybdis IRC daemon configuration file.
'';
};
statedir = mkOption {
type = types.string;
default = "/var/lib/charybdis";
description = ''
Location of the state directory of charybdis.
'';
};
user = mkOption {
type = types.string;
default = "ircd";
description = ''
Charybdis IRC daemon user.
'';
};
group = mkOption {
type = types.string;
default = "ircd";
description = ''
Charybdis IRC daemon group.
'';
};
};
};
###### implementation
config = mkIf cfg.enable {
users.extraUsers = singleton {
name = cfg.user;
description = "Charybdis IRC daemon user";
uid = config.ids.uids.ircd;
group = cfg.group;
};
users.extraGroups = singleton {
name = cfg.group;
gid = config.ids.gids.ircd;
};
systemd.services.charybdis = {
description = "Charybdis IRC daemon";
wantedBy = [ "multi-user.target" ];
environment = {
BANDB_DBPATH = "${cfg.statedir}/ban.db";
};
serviceConfig = {
ExecStart = "${charybdis}/bin/charybdis-ircd -foreground -logfile /dev/stdout -configfile ${configFile}";
Group = cfg.group;
User = cfg.user;
PermissionsStartOnly = true; # preStart needs to run with root permissions
};
preStart = ''
if ! test -d /var/lib/charybdis; then
${coreutils}/bin/mkdir -p ${cfg.statedir}
${coreutils}/bin/chown ${cfg.user}:${cfg.group} ${cfg.statedir}
fi
'';
};
};
}

View File

@ -0,0 +1,34 @@
{ stdenv, fetchgit, bison, flex, openssl }:
stdenv.mkDerivation rec {
name = "charybdis-3.5.0-rc1";
src = fetchgit {
url = "https://github.com/atheme/charybdis.git";
rev = "43a9b61c427cd0f3fa2c192890b8a48d9ea6fb7f";
sha256 = "ae2c8a72e6a29c901f9b51759b542ee12c4ec918050a2d9d65e5635077a0fcef";
};
patches = [
./remove-setenv.patch
];
configureFlags = [
"--enable-epoll"
"--enable-ipv6"
"--enable-openssl=${openssl}"
"--with-program-prefix=charybdis-"
];
buildInputs = [ bison flex openssl ];
meta = {
description = "An extremely scalable ircd with some cooperation with the ratbox and ircu guys";
homepage = https://github.com/atheme/charybdis;
license = stdenv.lib.licenses.gpl2;
maintainers = [ stdenv.lib.maintainers.lassulus ];
platforms = stdenv.lib.platforms.all;
};
}

View File

@ -0,0 +1,12 @@
diff --git a/src/bandbi.c b/src/bandbi.c
index 03dd907..3698e85 100644
--- a/src/bandbi.c
+++ b/src/bandbi.c
@@ -82,7 +82,6 @@ start_bandb(void)
const char *suffix = "";
#endif
- rb_setenv("BANDB_DBPATH", PKGLOCALSTATEDIR "/ban.db", 1);
if(bandb_path == NULL)
{
rb_snprintf(fullpath, sizeof(fullpath), "%s/bandb%s", PKGLIBEXECDIR, suffix);

View File

@ -8433,6 +8433,8 @@ let
bosun = callPackage ../servers/monitoring/bosun {};
scollector = callPackage ../servers/monitoring/bosun/scollector.nix {};
charybdis = callPackage ../servers/irc/charybdis {};
couchdb = callPackage ../servers/http/couchdb {
spidermonkey = spidermonkey_185;
python = python27;