summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-12-25 00:04:52 +0100
committermakefu <github@syntax-fehler.de>2015-12-25 00:04:52 +0100
commit70264d1e46dc17391f0a3a590ba0749d0a93eda2 (patch)
tree0ef0f3308ea75521a1d68ff5264dcc9d1f5ee1b5 /krebs
parent58f37bde831877e467646d283b88c17251b84b7c (diff)
k 5 Reaktor: init plugin infrastructure
Diffstat (limited to 'krebs')
-rw-r--r--krebs/5pkgs/Reaktor/plugins.nix38
-rw-r--r--krebs/5pkgs/Reaktor/scripts/random-emoji.sh6
-rw-r--r--krebs/5pkgs/default.nix2
3 files changed, 46 insertions, 0 deletions
diff --git a/krebs/5pkgs/Reaktor/plugins.nix b/krebs/5pkgs/Reaktor/plugins.nix
new file mode 100644
index 000000000..05ede38e1
--- /dev/null
+++ b/krebs/5pkgs/Reaktor/plugins.nix
@@ -0,0 +1,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"])
+ '';
+ };
+}
diff --git a/krebs/5pkgs/Reaktor/scripts/random-emoji.sh b/krebs/5pkgs/Reaktor/scripts/random-emoji.sh
new file mode 100644
index 000000000..386aa68b9
--- /dev/null
+++ b/krebs/5pkgs/Reaktor/scripts/random-emoji.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+curl http://emojicons.com/random -s | \
+ grep data-text | \
+ sed -n 's/.*>\(.*\)<\/textarea>/\1/p' | \
+ head -n 1 | \
+ xmlstarlet unesc
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 0562fe836..c4b1dafe4 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -26,6 +26,8 @@ subdirs // rec {
inherit (subdirs) get jq;
};
+ ReaktorPlugins = pkgs.callPackage ./Reaktor/plugins.nix {};
+
execve = name: { filename, argv, envp ? {}, destination ? "" }:
writeC name { inherit destination; } ''
#include <unistd.h>