Reaktor: add extraEnviron for setting Channel

This commit is contained in:
makefu 2015-09-27 21:50:40 +02:00
parent bc2bd6e2f6
commit d9f4d621bc
3 changed files with 20 additions and 11 deletions

View File

@ -2,7 +2,6 @@
let let
kpkgs = import ../5pkgs { inherit pkgs; inherit lib; };
inherit (lib) inherit (lib)
mkIf mkIf
@ -63,13 +62,20 @@ let
configuration appended to the default or overridden configuration configuration appended to the default or overridden configuration
''; '';
}; };
extraEnviron = mkOption {
ReaktorPkg = mkOption { default = {};
default = kpkgs.Reaktor; type = types.attrsOf types.str;
description = '' description = ''
the Reaktor pkg to use. Environment to be provided to the service, can be:
REAKTOR_HOST
REAKTOR_PORT
REAKTOR_STATEDIR
REAKTOR_CHANNELS
debug and nickname can be set separately via the Reaktor api
''; '';
}; };
debug = mkOption { debug = mkOption {
default = false; default = false;
description = '' description = ''
@ -80,7 +86,6 @@ let
imp = { imp = {
# for reaktor get-config # for reaktor get-config
environment.systemPackages = [ cfg.ReaktorPkg ];
users.extraUsers = singleton { users.extraUsers = singleton {
name = "Reaktor"; name = "Reaktor";
# uid = config.ids.uids.Reaktor; # uid = config.ids.uids.Reaktor;
@ -98,7 +103,7 @@ let
systemd.services.Reaktor = { systemd.services.Reaktor = {
path = with pkgs; [ path = with pkgs; [
utillinux #flock for tell_on-join utillinux #flock for tell_on-join
# git # for nag git # for nag
python # for caps python # for caps
]; ];
description = "Reaktor IRC Bot"; description = "Reaktor IRC Bot";
@ -108,17 +113,17 @@ let
GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
REAKTOR_NICKNAME = cfg.nickname; REAKTOR_NICKNAME = cfg.nickname;
REAKTOR_DEBUG = (if cfg.debug then "True" else "False"); REAKTOR_DEBUG = (if cfg.debug then "True" else "False");
}; } // cfg.extraEnviron;
serviceConfig= { serviceConfig= {
ExecStartPre = pkgs.writeScript "Reaktor-init" '' ExecStartPre = pkgs.writeScript "Reaktor-init" ''
#! /bin/sh #! /bin/sh
${if (isString cfg.overrideConfig) then ${if (isString cfg.overrideConfig) then
''cp ${ReaktorConfig} /tmp/config.py'' ''cp ${ReaktorConfig} /tmp/config.py''
else else
''(${cfg.ReaktorPkg}/bin/reaktor get-config;cat "${ReaktorConfig}" ) > /tmp/config.py'' ''(${pkgs.Reaktor}/bin/reaktor get-config;cat "${ReaktorConfig}" ) > /tmp/config.py''
} }
''; '';
ExecStart = "${cfg.ReaktorPkg}/bin/reaktor run /tmp/config.py"; ExecStart = "${pkgs.Reaktor}/bin/reaktor run /tmp/config.py";
PrivateTmp = "true"; PrivateTmp = "true";
User = "Reaktor"; User = "Reaktor";
Restart = "on-abort"; Restart = "on-abort";

View File

@ -32,6 +32,10 @@
]; ];
krebs.Reaktor.enable = true; krebs.Reaktor.enable = true;
krebs.Reaktor.debug = true; krebs.Reaktor.debug = true;
krebs.Reaktor.nickname = "Reaktor|bot";
krebs.Reaktor.extraEnviron = {
REAKTOR_CHANNELS = "#krebs,#binaergewitter";
};
krebs.build.host = config.krebs.hosts.pnp; krebs.build.host = config.krebs.hosts.pnp;
krebs.build.user = config.krebs.users.makefu; krebs.build.user = config.krebs.users.makefu;

View File

@ -9,7 +9,7 @@ let
sha256 = "1ykwpjvfgj11iwhx70bh2hbxhyy3hg6rnqzl4qac7xzg8xw8wqg4"; sha256 = "1ykwpjvfgj11iwhx70bh2hbxhyy3hg6rnqzl4qac7xzg8xw8wqg4";
}; };
in { in {
inherit vboxguestpkg; #inherit vboxguestpkg;
virtualisation.virtualbox.host.enable = true; virtualisation.virtualbox.host.enable = true;
nixpkgs.config.virtualbox.enableExtensionPack = true; nixpkgs.config.virtualbox.enableExtensionPack = true;