summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/Reaktor/plugins.nix
blob: 05ede38e15dc21e4249a6e14fa67504e7ed8d4b8 (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
{ stdenv, lib, pkgs, makeWrapper }:

rec {
  buildReaktorPlugin = { name
                        # TODO: profiles
                        , extraConfig
                        , phases ? []
                        , ... } @ attrs:
    stdenv.mkDerivation (attrs // {
      name = "Reaktor-plugin-" + name;
      phases = phases ++ [ "installPhase" ];
      isReaktorPlugin = true;
    });

  random-emoji = buildReaktorPlugin rec {
    name = "random-emoji";
    src = ./scripts/random-emoji.sh;
    phases = [ "installPhase" ];
    buildInputs = [ makeWrapper ];
    installPhase = ''
      mkdir -p $out/bin
      install -vm 755 ${src} $out/bin/random-emoji.sh
      wrapProgram $out/bin/random-emoji.sh \
        --prefix PATH : ${lib.makeSearchPath "bin" (with pkgs; [
                          coreutils
                          gnused
                          gnugrep
                          xmlstarlet
                          curl])};
    '';
    extraConfig = ''
      public_commands.insert(0,{
        'capname' : "emoji",
        'pattern' : indirect_pattern.format("emoji"),
        'argv'    : ["random-emoji.sh"])
    '';
  };
}