summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2018-07-17 20:22:52 +0200
committertv <tv@krebsco.de>2018-07-17 20:22:52 +0200
commit3dedfb8de4dc7e741f4db5310739884fba68b5bd (patch)
tree25e2955462d2998afe04356128f9d464d1b40b52 /krebs/5pkgs/simple
parent75aa3b118b6c74b2e87ccf7e3da53aa06fa7d569 (diff)
parent74698c904460db569a3c6c8355c0b25a94c98800 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/Reaktor/plugins.nix50
-rw-r--r--krebs/5pkgs/simple/cholerab/default.nix7
-rw-r--r--krebs/5pkgs/simple/ftb/default.nix4
-rw-r--r--krebs/5pkgs/simple/thesauron/default.nix7
4 files changed, 49 insertions, 19 deletions
diff --git a/krebs/5pkgs/simple/Reaktor/plugins.nix b/krebs/5pkgs/simple/Reaktor/plugins.nix
index 2df76fb2f..db578c457 100644
--- a/krebs/5pkgs/simple/Reaktor/plugins.nix
+++ b/krebs/5pkgs/simple/Reaktor/plugins.nix
@@ -121,26 +121,56 @@ rec {
pattern = "^.*(?P<args>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+).*$$";
path = with pkgs; [ curl perl ];
script = pkgs.writePython3 "url-title" [ "beautifulsoup4" "lxml" ] ''
+ import cgi
import sys
import urllib.request
from bs4 import BeautifulSoup
try:
- soup = BeautifulSoup(urllib.request.urlopen(sys.argv[1]), "lxml")
- title = soup.find('title').string
-
- if title:
- if len(title) > 512:
- print('message to long, skipped')
- elif len(title.split('\n')) > 5:
- print('to many lines, skipped')
- else:
- print(title)
+ req = urllib.request.Request(sys.argv[1])
+ req.add_header('user-agent', 'Reaktor-url-title')
+ resp = urllib.request.urlopen(req)
+ if resp.headers['content-type'].find('text/html') >= 0:
+ soup = BeautifulSoup(resp.read(16000), "lxml")
+ title = soup.find('title').string
+
+ if len(title.split('\n')) > 5:
+ title = '\n'.join(title.split('\n')[:5])
+
+ print(title[:450])
+ else:
+ cd_header = resp.headers['content-disposition']
+ print(cgi.parse_header(cd_header)[1]['filename'])
except: # noqa: E722
pass
'';
});
+ taskrcFile = builtins.toFile "taskrc" ''
+ confirmation=no
+ '';
+
+ task-add = buildSimpleReaktorPlugin "task-add" {
+ pattern = "^task-add: (?P<args>.*)$$";
+ script = pkgs.writeDash "task-add" ''
+ ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} add "$*"
+ '';
+ };
+
+ task-list = buildSimpleReaktorPlugin "task-list" {
+ pattern = "^task-list";
+ script = pkgs.writeDash "task-list" ''
+ ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} list
+ '';
+ };
+
+ task-delete = buildSimpleReaktorPlugin "task-delete" {
+ pattern = "^task-remove: (?P<args>.*)$$";
+ script = pkgs.writeDash "task-delete" ''
+ ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} delete "$*"
+ '';
+ };
+
todo = name: {
add = buildSimpleReaktorPlugin "${name}-add" {
pattern = "^${name}-add: (?P<args>.*)$$";
diff --git a/krebs/5pkgs/simple/cholerab/default.nix b/krebs/5pkgs/simple/cholerab/default.nix
new file mode 100644
index 000000000..94514fe44
--- /dev/null
+++ b/krebs/5pkgs/simple/cholerab/default.nix
@@ -0,0 +1,7 @@
+{ fetchgit, callPackage }: let
+ src = fetchgit {
+ url = "https://github.com/krebs/cholerab";
+ rev = "25d7ef051d6fc74d99b155e768b3c650296a230c";
+ sha256 = "1pymw7v2ql42iq825ccx98s4fp9jsz5b2hjr1qad6bamfc6i7yy9";
+ };
+in callPackage src {}
diff --git a/krebs/5pkgs/simple/ftb/default.nix b/krebs/5pkgs/simple/ftb/default.nix
index c2e83c9f4..ab7d6e651 100644
--- a/krebs/5pkgs/simple/ftb/default.nix
+++ b/krebs/5pkgs/simple/ftb/default.nix
@@ -1,7 +1,7 @@
{ stdenv, fetchurl
, jre, libX11, libXext, libXcursor, libXrandr, libXxf86vm
, openjdk
-, mesa, openal
+, mesa_glu, openal
, useAlsa ? false, alsaOss ? null }:
with stdenv.lib;
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
#!${stdenv.shell}
export _JAVA_AWT_WM_NONREPARENTING=1
- export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm mesa openal ]}
+ export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${makeLibraryPath [ libX11 libXext libXcursor libXrandr libXxf86vm mesa_glu openal ]}
${if useAlsa then "${alsaOss}/bin/aoss" else "" } \
${jre}/bin/java -jar $out/ftb.jar
EOF
diff --git a/krebs/5pkgs/simple/thesauron/default.nix b/krebs/5pkgs/simple/thesauron/default.nix
deleted file mode 100644
index d543319f2..000000000
--- a/krebs/5pkgs/simple/thesauron/default.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ fetchgit, callPackage }: let
- src = fetchgit {
- url = "https://github.com/krebs/thesauron";
- rev = "8ac22588cf2c20465e3c9348e7ce04885599c2a5";
- "sha256"= "1ivkjl235dnm5aaqqvarnxkz7zh0gvah22b0fqwlsflrcd5wmgva";
- };
-in callPackage src {}