diff options
author | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
---|---|---|
committer | Mx Kookie <kookie@spacekookie.de> | 2020-10-31 19:35:09 +0100 |
commit | c4625b175f8200f643fd6e11010932ea44c78433 (patch) | |
tree | bce3f89888c8ac3991fa5569a878a9eab6801ccc /infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts | |
parent | 49f735974dd103039ddc4cb576bb76555164a9e7 (diff) | |
parent | d661aa56a8843e991261510c1bb28fdc2f6975ae (diff) |
Add 'infra/libkookie/' from commit 'd661aa56a8843e991261510c1bb28fdc2f6975ae'
git-subtree-dir: infra/libkookie
git-subtree-mainline: 49f735974dd103039ddc4cb576bb76555164a9e7
git-subtree-split: d661aa56a8843e991261510c1bb28fdc2f6975ae
Diffstat (limited to 'infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts')
11 files changed, 383 insertions, 0 deletions
diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix new file mode 100644 index 000000000000..6d228688607a --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix @@ -0,0 +1,17 @@ +{ callPackage, luaPackages, python3Packages }: + +{ + weechat-matrix-bridge = callPackage ./weechat-matrix-bridge { + inherit (luaPackages) cjson luaffi; + }; + + weechat-matrix = python3Packages.callPackage ./weechat-matrix { }; + + weechat-notify-send = python3Packages.callPackage ./weechat-notify-send { }; + + wee-slack = callPackage ./wee-slack { }; + + weechat-autosort = callPackage ./weechat-autosort { }; + + weechat-otr = callPackage ./weechat-otr { }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix new file mode 100644 index 000000000000..9650f903ed6b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix @@ -0,0 +1,45 @@ +{ stdenv, substituteAll, buildEnv, fetchFromGitHub, python3Packages }: + +stdenv.mkDerivation rec { + pname = "wee-slack"; + version = "2.6.0"; + + src = fetchFromGitHub { + repo = "wee-slack"; + owner = "wee-slack"; + rev = "v${version}"; + sha256 = "0s4qd1z40c1bczkvc840jwjmzbv7nyj06xqs1si9v54qmkh4gaq4"; + }; + + patches = [ + (substituteAll { + src = ./libpath.patch; + env = "${buildEnv { + name = "wee-slack-env"; + paths = with python3Packages; [ websocket_client six ]; + }}/${python3Packages.python.sitePackages}"; + }) + ./hardcode-json-file-path.patch + ]; + + postPatch = '' + substituteInPlace wee_slack.py --subst-var out + ''; + + passthru.scripts = [ "wee_slack.py" ]; + + installPhase = '' + mkdir -p $out/share + cp wee_slack.py $out/share/wee_slack.py + install -D -m 0444 weemoji.json $out/share/wee-slack/weemoji.json + ''; + + meta = with stdenv.lib; { + homepage = "https://github.com/wee-slack/wee-slack"; + license = licenses.mit; + maintainers = with maintainers; [ willibutz ]; + description = '' + A WeeChat plugin for Slack.com. Synchronizes read markers, provides typing notification, search, etc.. + ''; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch new file mode 100644 index 000000000000..7413a9229ce6 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/hardcode-json-file-path.patch @@ -0,0 +1,12 @@ +--- a/wee_slack.py ++++ b/wee_slack.py +@@ -4560,8 +4560,7 @@ + + def load_emoji(): + try: +- DIR = w.info_get('weechat_dir', '') +- with open('{}/weemoji.json'.format(DIR), 'r') as ef: ++ with open('@out@/share/wee-slack/weemoji.json', 'r') as ef: + emojis = json.loads(ef.read()) + if 'emoji' in emojis: + print_error('The weemoji.json file is in an old format. Please update it.') diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/libpath.patch b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/libpath.patch new file mode 100644 index 000000000000..af2dd36b41c5 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/libpath.patch @@ -0,0 +1,13 @@ +diff --git a/wee_slack.py b/wee_slack.py +index dbe6446..d1b7546 100644 +--- a/wee_slack.py ++++ b/wee_slack.py +@@ -25,6 +25,8 @@ import random + import socket + import string + ++sys.path.append('@env@') ++ + from websocket import ABNF, create_connection, WebSocketConnectionClosedException + + try: diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-autosort/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-autosort/default.nix new file mode 100644 index 000000000000..883ed793ced6 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-autosort/default.nix @@ -0,0 +1,25 @@ +{ stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "weechat-autosort"; + version = "3.8"; + + src = fetchFromGitHub { + owner = "de-vri-es"; + repo = pname; + rev = version; + sha256 = "0a2gc8nhklvlivradhqy2pkymsqyy01pvzrmwg60cln8snmcqpd5"; + }; + + passthru.scripts = [ "autosort.py" ]; + installPhase = '' + install -D autosort.py $out/share/autosort.py + ''; + + meta = with stdenv.lib; { + description = "Autosort is a weechat script to automatically or manually keep your buffers sorted"; + homepage = "https://github.com/de-vri-es/weechat-autosort"; + license = licenses.gpl3; + maintainers = with maintainers; [ emily ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/default.nix new file mode 100644 index 000000000000..5c734bf7de2b --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/default.nix @@ -0,0 +1,50 @@ +{ stdenv, curl, fetchFromGitHub, cjson, olm, luaffi }: + +stdenv.mkDerivation { + name = "weechat-matrix-bridge-2018-11-19"; + src = fetchFromGitHub { + owner = "torhve"; + repo = "weechat-matrix-protocol-script"; + rev = "8d32e90d864a8f3f09ecc2857cd5dd6e39a8c3f7"; + sha256 = "0qqd6qmkrdc0r3rnl53c3yp93fbcz7d3mdw3vq5gmdqxyym4s9lj"; + }; + + patches = [ + ./library-path.patch + ]; + + buildInputs = [ curl cjson olm luaffi ]; + + postPatch = '' + substituteInPlace matrix.lua \ + --replace "/usr/bin/curl" "${curl}/bin/curl" \ + --replace "__NIX_LIB_PATH__" "$out/lib/?.so" \ + --replace "__NIX_OLM_PATH__" "$out/share/?.lua" + + substituteInPlace olm.lua \ + --replace "__NIX_LIB_PATH__" "$out/lib/?.so" + ''; + + passthru.scripts = [ "matrix.lua" ]; + + installPhase = '' + mkdir -p $out/{share,lib} + + cp {matrix.lua,olm.lua} $out/share + cp ${cjson}/lib/lua/${cjson.lua.luaversion}/cjson.so $out/lib/cjson.so + cp ${olm}/lib/libolm.so $out/lib/libolm.so + cp ${luaffi}/lib/lua/${luaffi.lua.luaversion}/ffi.so $out/lib/ffi.so + ''; + + meta = with stdenv.lib; { + description = "A WeeChat script in Lua that implements the matrix.org chat protocol"; + homepage = "https://github.com/torhve/weechat-matrix-protocol-script"; + maintainers = with maintainers; [ ]; + license = licenses.mit; # see https://github.com/torhve/weechat-matrix-protocol-script/blob/0052e7275ae149dc5241226391c9b1889ecc3c6b/matrix.lua#L53 + platforms = platforms.unix; + + # As of 2019-06-30, all of the dependencies are available on macOS but the + # package itself does not build. + broken = stdenv.isDarwin; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/library-path.patch b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/library-path.patch new file mode 100644 index 000000000000..d9945c2993b7 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/library-path.patch @@ -0,0 +1,28 @@ +diff --git a/matrix.lua b/matrix.lua +index b79f500..32b37a2 100644 +--- a/matrix.lua ++++ b/matrix.lua +@@ -43,6 +43,9 @@ This script maps this as follows: + + ]] + ++package.cpath = package.cpath .. ";__NIX_LIB_PATH__" ++package.path = package.path .. ";__NIX_OLM_PATH__" ++ + local json = require 'cjson' -- apt-get install lua-cjson + local olmstatus, olm = pcall(require, 'olm') -- LuaJIT olm FFI binding ln -s ~/olm/olm.lua /usr/local/share/lua/5.1 + local w = weechat +diff --git a/olm.lua b/olm.lua +index 114649c..4828371 100644 +--- a/olm.lua ++++ b/olm.lua +@@ -17,6 +17,9 @@ + * limitations under the License. + */ + --]] ++ ++package.cpath = package.cpath .. ";__NIX_LIB_PATH__" ++ + local ffi = require'ffi' + + ffi.cdef[[ diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix new file mode 100644 index 000000000000..aca9a9a111d6 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix @@ -0,0 +1,79 @@ +{ buildPythonPackage +, stdenv +, python +, fetchFromGitHub +, pyopenssl +, webcolors +, future +, atomicwrites +, attrs +, Logbook +, pygments +, matrix-nio +, aiohttp +, requests +}: + +let + scriptPython = python.withPackages (ps: with ps; [ + aiohttp + requests + python_magic + ]); +in buildPythonPackage { + pname = "weechat-matrix"; + version = "0.1.0"; + + src = fetchFromGitHub { + owner = "poljar"; + repo = "weechat-matrix"; + rev = "65a5db7291439b6132e35e8cc09ed901614fabf6"; + sha256 = "0m3k5vrv5ab1aw1mjd0r8d71anwqzvncvv9v5zx9xp1i188sdm8x"; + }; + + propagatedBuildInputs = [ + pyopenssl + webcolors + future + atomicwrites + attrs + Logbook + pygments + matrix-nio + aiohttp + requests + ]; + + passthru.scripts = [ "matrix.py" ]; + + dontBuild = true; + doCheck = false; + + installPhase = '' + mkdir -p $out/share $out/bin + cp $src/main.py $out/share/matrix.py + + cp $src/contrib/matrix_upload.py $out/bin/matrix_upload + cp $src/contrib/matrix_decrypt.py $out/bin/matrix_decrypt + cp $src/contrib/matrix_sso_helper.py $out/bin/matrix_sso_helper + substituteInPlace $out/bin/matrix_upload \ + --replace '/usr/bin/env -S python3' '${scriptPython}/bin/python' + substituteInPlace $out/bin/matrix_sso_helper \ + --replace '/usr/bin/env -S python3' '${scriptPython}/bin/python' + substituteInPlace $out/bin/matrix_decrypt \ + --replace '/usr/bin/env python3' '${scriptPython}/bin/python' + + mkdir -p $out/${python.sitePackages} + cp -r $src/matrix $out/${python.sitePackages}/matrix + ''; + + dontPatchShebangs = true; + + meta = with stdenv.lib; { + description = "A Python plugin for Weechat that lets Weechat communicate over the Matrix protocol"; + homepage = "https://github.com/poljar/weechat-matrix"; + license = licenses.isc; + platforms = platforms.unix; + maintainers = with maintainers; [ tilpner emily ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-notify-send/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-notify-send/default.nix new file mode 100644 index 000000000000..d219aa481cdb --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-notify-send/default.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchFromGitHub, libnotify }: + +stdenv.mkDerivation rec { + pname = "weechat-notify-send"; + version = "0.9"; + + src = fetchFromGitHub { + owner = "s3rvac"; + repo = pname; + rev = "v${version}"; + sha256 = "1693b7axm9ls5p7hm6kq6avddsisi491khr5irvswr5lpizvys6a"; + }; + + passthru.scripts = [ "notify_send.py" ]; + + dontBuild = true; + doCheck = false; + + installPhase = '' + install -D notify_send.py $out/share/notify_send.py + substituteInPlace $out/share/notify_send.py \ + --replace "'notify-send'" "'${libnotify}/bin/notify-send'" + ''; + + meta = with stdenv.lib; { + description = "A WeeChat script that sends highlight and message notifications through notify-send"; + homepage = "https://github.com/s3rvac/weechat-notify-srnd"; + license = licenses.mit; + maintainers = with maintainers; [ tobim ]; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix new file mode 100644 index 000000000000..c7f2958cf553 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix @@ -0,0 +1,70 @@ +{ stdenv, substituteAll, buildEnv, fetchgit, fetchFromGitHub, python3Packages, gmp }: + +let + # pure-python-otr (potr) requires an older version of pycrypto, which is + # not compatible with pycryptodome. Therefore, the latest patched version + # of pycrypto will be fetched from the Debian project. + # https://security-tracker.debian.org/tracker/source-package/python-crypto + + pycrypto = python3Packages.buildPythonPackage rec { + pname = "pycrypto"; + version = "2.6.1-13.1"; + + src = fetchgit { + url = "https://salsa.debian.org/sramacher/python-crypto.git"; + rev = "debian/${version}"; + sha256 = "1mahqmlgilgk0rn5hfkhza7kscfm7agdakkb6rqnif9g0qp3s52f"; + }; + + postPatch = '' + for p in debian/patches/*.patch; do + patch -p1 < "$p" + done + ''; + + buildInputs = [ gmp ]; + + preConfigure = '' + sed -i 's,/usr/include,/no-such-dir,' configure + sed -i "s!,'/usr/include/'!!" setup.py + ''; + }; + + potr = python3Packages.potr.overridePythonAttrs (oldAttrs: { + propagatedBuildInputs = [ pycrypto ]; + }); +in stdenv.mkDerivation rec { + pname = "weechat-otr"; + version = "1.9.2"; + + src = fetchFromGitHub { + repo = pname; + owner = "mmb"; + rev = "v${version}"; + sha256 = "1lngv98y6883vk8z2628cl4d5y8jxy39w8245gjdvshl8g18k5s2"; + }; + + patches = [ + (substituteAll { + src = ./libpath.patch; + env = "${buildEnv { + name = "weechat-otr-env"; + paths = [ potr pycrypto ]; + }}/${python3Packages.python.sitePackages}"; + }) + ]; + + passthru.scripts = [ "weechat_otr.py" ]; + + installPhase = '' + mkdir -p $out/share + cp weechat_otr.py $out/share/weechat_otr.py + ''; + + meta = with stdenv.lib; { + homepage = "https://github.com/mmb/weechat-otr"; + license = licenses.gpl3; + maintainers = with maintainers; [ oxzi ]; + description = "WeeChat script for Off-the-Record messaging"; + }; +} diff --git a/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch new file mode 100644 index 000000000000..a7b77ed9b602 --- /dev/null +++ b/infra/libkookie/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch @@ -0,0 +1,13 @@ +diff --git a/weechat_otr.py b/weechat_otr.py +index 0ccfb35..c42bebf 100644 +--- a/weechat_otr.py ++++ b/weechat_otr.py +@@ -41,6 +41,8 @@ import shlex + import shutil + import sys + ++sys.path.append('@env@') ++ + import potr + import weechat + |