summaryrefslogtreecommitdiffstats
path: root/lass/2configs/reaktor-coders.nix
blob: 7cdcdf20cea7d743db7034293d5eab946c786628 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;

{
  krebs.Reaktor.coders = {
    nickname = "Reaktor|lass";
    channels = [ "#coders" "#germany" "#panthermoderns" ];
    extraEnviron = {
      REAKTOR_HOST = "irc.hackint.org";
    };
    plugins = with pkgs.ReaktorPlugins; let

      lambdabot = (import (pkgs.fetchFromGitHub {
        owner = "NixOS"; repo = "nixpkgs";
        rev = "a4ec1841da14fc98c5c35cc72242c23bb698d4ac";
        sha256 = "148fpw31s922hxrf28yhrci296f7c7zd81hf0k6zs05rq0i3szgy";
      }) {}).lambdabot;

      lambdabotflags = ''
        -XStandaloneDeriving -XGADTs -XFlexibleContexts \
        -XFlexibleInstances -XMultiParamTypeClasses \
        -XOverloadedStrings -XFunctionalDependencies \'';
    in [
      sed-plugin
      url-title
      (buildSimpleReaktorPlugin "lambdabot-pl" {
        pattern = "^@pl (?P<args>.*)$$";
        script = pkgs.writeDash "lambda-pl" ''
          exec ${lambdabot}/bin/lambdabot \
            ${indent lambdabotflags}
            -e "@pl $1"
        '';
      })
      (buildSimpleReaktorPlugin "lambdabot-type" {
        pattern = "^@type (?P<args>.*)$$";
        script = pkgs.writeDash "lambda-type" ''
          exec ${lambdabot}/bin/lambdabot \
            ${indent lambdabotflags}
            -e "@type $1"
        '';
      })
      (buildSimpleReaktorPlugin "lambdabot-let" {
        pattern = "^@let (?P<args>.*)$$";
        script = pkgs.writeDash "lambda-let" ''
          exec ${lambdabot}/bin/lambdabot \
            ${indent lambdabotflags}
            -e "@let $1"
        '';
      })
      (buildSimpleReaktorPlugin "lambdabot-run" {
        pattern = "^@run (?P<args>.*)$$";
        script = pkgs.writeDash "lambda-run" ''
          exec ${lambdabot}/bin/lambdabot \
            ${indent lambdabotflags}
            -e "@run $1"
        '';
      })
      (buildSimpleReaktorPlugin "lambdabot-kind" {
        pattern = "^@kind (?P<args>.*)$$";
        script = pkgs.writeDash "lambda-kind" ''
          exec ${lambdabot}/bin/lambdabot \
            ${indent lambdabotflags}
            -e "@kind $1"
        '';
      })
      (buildSimpleReaktorPlugin "ping" {
        pattern = "^!ping (?P<args>.*)$$";
        script = pkgs.writeDash "ping" ''
          exec /run/wrappers/bin/ping -q -c1 "$1" 2>&1 | tail -1
        '';
      })
      (buildSimpleReaktorPlugin "google" {
        pattern = "^!g (?P<args>.*)$$";
        script = pkgs.writeDash "google" ''
          exec ${pkgs.ddgr}/bin/ddgr -C -n1 --json "$@" | \
            ${pkgs.jq}/bin/jq '@text "\(.[0].abstract) \(.[0].url)"'
        '';
      })
      (buildSimpleReaktorPlugin "blockchain" {
        pattern = ".*[Bb]lockchain.*$$";
        script = pkgs.writeDash "blockchain" ''
          exec echo 'DID SOMEBODY SAY BLOCKCHAIN? https://paste.krebsco.de/r99pMoQq/+inline'
        '';
      })
      (buildSimpleReaktorPlugin "shrug" {
        pattern = "^!shrug$";
        script = pkgs.writeDash "shrug" ''
          exec echo '¯\_(ツ)_/¯'
        '';
      })
      (buildSimpleReaktorPlugin "flip" {
        pattern = "^!flip$";
        script = pkgs.writeDash "shrug" ''
          exec echo '(╯°□°)╯ ┻━┻'
        '';
      })
    ];
  };
}