summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-08-31 14:22:21 +0200
committermakefu <github@syntax-fehler.de>2015-08-31 14:22:21 +0200
commit0f50750e254c22153cb7024e79181661f98d1b33 (patch)
tree0108ace486835db113cc5fa0fc6d491050117b25 /krebs
parentcbac1a75959c96d37f6c24a38efce19e88dadca2 (diff)
Reaktor: initial commit at 0.3.5
Diffstat (limited to 'krebs')
-rw-r--r--krebs/3modules/Reaktor.nix97
-rw-r--r--krebs/3modules/default.nix1
-rw-r--r--krebs/5pkgs/Reaktor/default.nix19
-rw-r--r--krebs/5pkgs/default.nix1
4 files changed, 118 insertions, 0 deletions
diff --git a/krebs/3modules/Reaktor.nix b/krebs/3modules/Reaktor.nix
new file mode 100644
index 000000000..2ca7a0ee3
--- /dev/null
+++ b/krebs/3modules/Reaktor.nix
@@ -0,0 +1,97 @@
+{ config, pkgs,lib, ... }:
+
+
+let
+ kpkgs = import ../5pkgs { inherit pkgs; inherit lib; };
+
+ inherit (lib)
+ mkIf
+ mkOption
+ types
+ singleton
+ isString
+ optionalString
+ concatStrings
+ ;
+
+ ReaktorConfig = mkIf ( isString cfg.extraConfig ) pkgs.writeText "config.py" cfg.extraConfig;
+ cfg = config.krebs.Reaktor;
+
+ out = {
+ options.krebs.Reaktor = api;
+ config = mkIf cfg.enable imp;
+ };
+
+ api = {
+ enable = mkOption {
+ default = false;
+ description = ''
+ Start Reaktor at system boot
+ '';
+ };
+
+ nickname = mkOption {
+ default = config.krebs.build.host.name + "|r";
+ type = types.str;
+ description = ''
+ The nick name of the irc bot.
+ Defaults to {hostname}|r
+ '';
+ };
+
+
+ extraConfig = mkOption {
+ default = null;
+ type = types.nullOr types.str;
+ description = ''
+ configuration to be used instead of default ones.
+ Reaktor default cfg can be retrieved via `reaktor get-config`
+ '';
+ };
+
+ ReaktorPkg = mkOption {
+ default = kpkgs.Reaktor;
+ description = ''
+ the Reaktor pkg to use.
+ '';
+ };
+ };
+
+ imp = {
+ # for reaktor get-config
+ environment.systemPackages = [ cfg.ReaktorPkg ];
+
+ users.extraUsers = singleton {
+ name = "Reaktor";
+ # uid = config.ids.uids.Reaktor;
+ uid = 2066439104; #genid Reaktor
+ description = "Reaktor user";
+ home = "/var/lib/Reaktor";
+ createHome = true;
+ };
+
+ #users.extraGroups = singleton {
+ # name = "Reaktor";
+ # gid = config.ids.gids.Reaktor;
+ #};
+
+ systemd.services.Reaktor = {
+ path = with pkgs; [
+ utillinux #flock for tell_on-join
+ # git # for nag
+ python # for caps
+ ];
+ description = "Reaktor IRC Bot";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ serviceConfig.User = "Reaktor";
+ environment = {
+ GIT_SSL_CAINFO = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
+ IRC_NICKNAME = cfg.nickname;
+ };
+ serviceConfig.ExecStart = "${cfg.ReaktorPkg}/bin/reaktor run ${if (isString cfg.extraConfig) then cfg.ReaktorConfig else ""}";
+ };
+ };
+
+in
+out
diff --git a/krebs/3modules/default.nix b/krebs/3modules/default.nix
index 5f338df62..16ed92170 100644
--- a/krebs/3modules/default.nix
+++ b/krebs/3modules/default.nix
@@ -11,6 +11,7 @@ let
./github-hosts-sync.nix
./git.nix
./nginx.nix
+ ./Reaktor.nix
./retiolum.nix
./urlwatch.nix
];
diff --git a/krebs/5pkgs/Reaktor/default.nix b/krebs/5pkgs/Reaktor/default.nix
new file mode 100644
index 000000000..54e88d939
--- /dev/null
+++ b/krebs/5pkgs/Reaktor/default.nix
@@ -0,0 +1,19 @@
+{ lib, pkgs,buildPythonPackage,fetchurl, ... }:
+
+buildPythonPackage rec {
+ name = "Reaktor-${version}";
+ version = "0.3.5";
+ propagatedBuildInputs = with pkgs;[
+ pythonPackages.docopt
+ pythonPackages.requests
+ ];
+ src = fetchurl {
+ url = "https://pypi.python.org/packages/source/R/Reaktor/Reaktor-${version}.tar.gz";
+ sha256 = "1bi92hbm5f4z87biklh8lpjrmfhrdrj7x2hr64lkxpcabgs8kgyh";
+ };
+ meta = {
+ homepage = http://krebsco.de/;
+ description = "An IRC bot based on asynchat";
+ license = lib.licenses.wtfpl;
+ };
+}
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 500d5fe25..b42101820 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -19,6 +19,7 @@ rec {
nq = callPackage ./nq {};
posix-array = callPackage ./posix-array {};
pssh = callPackage ./pssh {};
+ Reaktor = callPackage ./Reaktor {};
youtube-tools = callPackage ./youtube-tools {};
execve = name: { filename, argv, envp ? {}, destination ? "" }: