diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/irc/weechat')
18 files changed, 739 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/default.nix new file mode 100644 index 000000000000..743f08635d38 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/default.nix @@ -0,0 +1,93 @@ +{ stdenv, fetchurl, lib +, ncurses, openssl, aspell, gnutls, gettext +, zlib, curl, pkg-config, libgcrypt +, cmake, makeWrapper, libobjc, libresolv, libiconv +, asciidoctor # manpages +, guileSupport ? true, guile +, luaSupport ? true, lua5 +, perlSupport ? true, perl +, pythonSupport ? true, python3Packages +, rubySupport ? true, ruby +, tclSupport ? true, tcl +, extraBuildInputs ? [] +}: + +let + inherit (python3Packages) python; + plugins = [ + { name = "perl"; enabled = perlSupport; cmakeFlag = "ENABLE_PERL"; buildInputs = [ perl ]; } + { name = "tcl"; enabled = tclSupport; cmakeFlag = "ENABLE_TCL"; buildInputs = [ tcl ]; } + { name = "ruby"; enabled = rubySupport; cmakeFlag = "ENABLE_RUBY"; buildInputs = [ ruby ]; } + { name = "guile"; enabled = guileSupport; cmakeFlag = "ENABLE_GUILE"; buildInputs = [ guile ]; } + { name = "lua"; enabled = luaSupport; cmakeFlag = "ENABLE_LUA"; buildInputs = [ lua5 ]; } + { name = "python"; enabled = pythonSupport; cmakeFlag = "ENABLE_PYTHON3"; buildInputs = [ python ]; } + ]; + enabledPlugins = builtins.filter (p: p.enabled) plugins; + + in + assert lib.all (p: p.enabled -> ! (builtins.elem null p.buildInputs)) plugins; + stdenv.mkDerivation rec { + version = "3.2"; + pname = "weechat"; + + hardeningEnable = [ "pie" ]; + + src = fetchurl { + url = "https://weechat.org/files/src/weechat-${version}.tar.bz2"; + sha256 = "0pck4lczkk52mgwa1n0habp1xqi9xsgsh5q6bbsjmdbandvy5vc8"; + }; + + outputs = [ "out" "man" ] ++ map (p: p.name) enabledPlugins; + + cmakeFlags = with lib; [ + "-DENABLE_MAN=ON" + "-DENABLE_DOC=ON" + "-DENABLE_JAVASCRIPT=OFF" # Requires v8 <= 3.24.3, https://github.com/weechat/weechat/issues/360 + "-DENABLE_PHP=OFF" + + # This just means it's okay to use Python 3 if it's in the environment. + "-DENABLE_PYTHON3=ON" + ] + ++ optionals stdenv.isDarwin ["-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib"] + ++ map (p: "-D${p.cmakeFlag}=" + (if p.enabled then "ON" else "OFF")) plugins + ; + + nativeBuildInputs = [ cmake pkg-config makeWrapper asciidoctor ]; + buildInputs = with lib; [ + ncurses openssl aspell gnutls gettext zlib curl + libgcrypt ] + ++ optionals stdenv.isDarwin [ libobjc libresolv ] + ++ concatMap (p: p.buildInputs) enabledPlugins + ++ extraBuildInputs; + + NIX_CFLAGS_COMPILE = "-I${python}/include/${python.libPrefix}" + # Fix '_res_9_init: undefined symbol' error + + (lib.optionalString stdenv.isDarwin "-DBIND_8_COMPAT=1 -lresolv"); + + postInstall = with lib; '' + for p in ${concatMapStringsSep " " (p: p.name) enabledPlugins}; do + from=$out/lib/weechat/plugins/$p.so + to=''${!p}/lib/weechat/plugins/$p.so + mkdir -p $(dirname $to) + mv $from $to + done + ''; + + doInstallCheck = true; + installCheckPhase = '' + $out/bin/weechat --version + ''; + + meta = { + homepage = "http://www.weechat.org/"; + description = "A fast, light and extensible chat client"; + longDescription = '' + You can find more documentation as to how to customize this package + (eg. adding python modules for scripts that would require them, etc.) + on https://nixos.org/nixpkgs/manual/#sec-weechat . + ''; + license = lib.licenses.gpl3; + maintainers = with lib.maintainers; [ lovek323 lheckemann ]; + platforms = lib.platforms.unix; + }; + } diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/colorize_nicks/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/colorize_nicks/default.nix new file mode 100644 index 000000000000..0b6d355797f3 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/colorize_nicks/default.nix @@ -0,0 +1,29 @@ +{ stdenv, lib, fetchurl, weechat }: + +stdenv.mkDerivation { + pname = "weechat-colorize_nicks"; + version = "27"; + + src = fetchurl { + url = "https://github.com/weechat/scripts/raw/bc8a9051800779a036ba11689a277cd5f03657b2/python/colorize_nicks.py"; + sha256 = "0hiay88vvy171jiq6ahflm0ipb7sslfxwhmmm8psv6qk19rv2sxs"; + }; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out/share + cp $src $out/share/colorize_nicks.py + ''; + + passthru = { + scripts = [ "colorize_nicks.py" ]; + }; + + meta = with lib; { + inherit (weechat.meta) platforms; + description = "Use the weechat nick colors in the chat area"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ qyliss ]; + }; +} diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix new file mode 100644 index 000000000000..1923e86abe20 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/default.nix @@ -0,0 +1,28 @@ +{ callPackage, luaPackages, perlPackages, python3Packages }: + +{ + colorize_nicks = callPackage ./colorize_nicks { }; + + go = callPackage ./go { }; + + multiline = callPackage ./multiline { + inherit (perlPackages) PodParser; + }; + + 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 { }; + + zncplayback = callPackage ./zncplayback { }; + +} diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/go/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/go/default.nix new file mode 100644 index 000000000000..5f0afbfdc6d9 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/go/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, fetchurl }: + +stdenv.mkDerivation { + pname = "go.py"; + version = "2.5"; + + src = fetchurl { + url = "https://github.com/weechat/scripts/raw/dc9e69f37fcdc51f0f5a8856ef977ee3d8d8e371/python/go.py"; + sha256 = "0ajfv4sl66jq02zzmdas81rvnv2l6dl3ckb4xzkyb3kdm68w31rf"; + }; + + unpackPhase = '' + : + ''; + + installPhase = '' + mkdir -p $out/share + cp $src $out/share/go.py + ''; + + passthru = { + scripts = [ "go.py" ]; + }; + + meta = with lib; { + description = "Quick jump to buffers"; + licenses = licenses.gpl3; + maintainers = with maintainers; [ qyliss ]; + }; +} diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/multiline/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/multiline/default.nix new file mode 100644 index 000000000000..447d415c163c --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/multiline/default.nix @@ -0,0 +1,40 @@ +{ stdenv, lib, fetchurl, substituteAll, PodParser }: + +stdenv.mkDerivation { + pname = "multiline"; + version = "0.6.3"; + + src = fetchurl { + url = "https://raw.githubusercontent.com/weechat/scripts/945315bed4bc2beaf1e47f9b946ffe8f638f77fe/perl/multiline.pl"; + sha256 = "1smialb21ny7brhij4sbw46xvsmrdv6ig2da0ip63ga2afngwsy4"; + }; + + dontUnpack = true; + prePatch = '' + cp $src multiline.pl + ''; + + patches = [ + # The script requires a special Perl environment. + (substituteAll { + src = ./libpath.patch; + env = PodParser; + }) + ]; + + passthru.scripts = [ "multiline.pl" ]; + + installPhase = '' + runHook preInstall + + install -D multiline.pl $out/share/multiline.pl + + runHook postInstall + ''; + + meta = with lib; { + description = "Multi-line edit box"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ oxzi ]; + }; +} diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/multiline/libpath.patch b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/multiline/libpath.patch new file mode 100644 index 000000000000..34299f20d8c2 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/multiline/libpath.patch @@ -0,0 +1,9 @@ +diff --git a/multiline.pl b/multiline.pl +index 54474d4..42fbef8 100644 +--- a/multiline.pl ++++ b/multiline.pl +@@ -1,3 +1,4 @@ ++use lib '@env@/lib/perl5/site_perl'; + use strict; use warnings; + $INC{'Encode/ConfigLocal.pm'}=1; + require Encode; diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix new file mode 100644 index 000000000000..aebe906659ef --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/default.nix @@ -0,0 +1,48 @@ +{ lib, stdenv, substituteAll, buildEnv, fetchFromGitHub, python3Packages }: + +stdenv.mkDerivation rec { + pname = "wee-slack"; + version = "2.8.0"; + + src = fetchFromGitHub { + repo = "wee-slack"; + owner = "wee-slack"; + rev = "v${version}"; + sha256 = "0xfklr0gsc9jgxfyrrb2j756lclz9g8imcb0pk0xgyj8mhsw23zk"; + }; + + patches = [ + (substituteAll { + src = ./libpath.patch; + env = "${buildEnv { + name = "wee-slack-env"; + paths = with python3Packages; [ + websocket-client + six + ]; + }}/${python3Packages.python.sitePackages}"; + }) + ./load_weemoji_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 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/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/libpath.patch b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/libpath.patch new file mode 100644 index 000000000000..a6e38c16fb14 --- /dev/null +++ b/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 e4716b4..f673b7c 100644 +--- a/wee_slack.py ++++ b/wee_slack.py +@@ -31,6 +31,8 @@ import string + # See https://github.com/numpy/numpy/issues/11925 + sys.modules["numpy"] = None + ++sys.path.append('@env@') ++ + from websocket import ( # noqa: E402 + ABNF, + create_connection, diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/load_weemoji_path.patch b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/load_weemoji_path.patch new file mode 100644 index 000000000000..1e97dc32fa65 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/wee-slack/load_weemoji_path.patch @@ -0,0 +1,25 @@ +diff --git a/wee_slack.py b/wee_slack.py +index e4716b4..ffd122d 100644 +--- a/wee_slack.py ++++ b/wee_slack.py +@@ -6092,19 +6092,7 @@ def create_slack_debug_buffer(): + + def load_emoji(): + try: +- weechat_dir = w.info_get("weechat_data_dir", "") or w.info_get( +- "weechat_dir", "" +- ) +- weechat_sharedir = w.info_get("weechat_sharedir", "") +- local_weemoji, global_weemoji = ( +- "{}/weemoji.json".format(path) for path in (weechat_dir, weechat_sharedir) +- ) +- path = ( +- global_weemoji +- if os.path.exists(global_weemoji) and not os.path.exists(local_weemoji) +- else local_weemoji +- ) +- with open(path, "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( diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-autosort/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-autosort/default.nix new file mode 100644 index 000000000000..49e74e0203ac --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-autosort/default.nix @@ -0,0 +1,25 @@ +{ lib, 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 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/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/default.nix new file mode 100644 index 000000000000..24cf26fbaf55 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/default.nix @@ -0,0 +1,50 @@ +{ lib, 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 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/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/library-path.patch b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix-bridge/library-path.patch new file mode 100644 index 000000000000..d9945c2993b7 --- /dev/null +++ b/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/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix new file mode 100644 index 000000000000..c82fb9ca7395 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-matrix/default.nix @@ -0,0 +1,86 @@ +{ buildPythonPackage +, lib +, python +, fetchFromGitHub +, pyopenssl +, webcolors +, future +, atomicwrites +, attrs +, Logbook +, pygments +, matrix-nio +, aiohttp +, requests +}: + +let + scriptPython = python.withPackages (ps: with ps; [ + aiohttp + requests + python_magic + ]); + + version = "0.2.0"; +in buildPythonPackage { + pname = "weechat-matrix"; + inherit version; + + src = fetchFromGitHub { + owner = "poljar"; + repo = "weechat-matrix"; + rev = version; + hash = "sha256-qsTdF9mGHac4rPs53mgoOElcujicRNXbJ7GsoptWSGc="; + }; + + 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 main.py $out/share/matrix.py + + cp contrib/matrix_upload.py $out/bin/matrix_upload + cp contrib/matrix_decrypt.py $out/bin/matrix_decrypt + cp 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 matrix $out/${python.sitePackages}/matrix + ''; + + dontPatchShebangs = true; + postFixup = '' + addToSearchPath program_PYTHONPATH $out/${python.sitePackages} + patchPythonScript $out/share/matrix.py + substituteInPlace $out/${python.sitePackages}/matrix/server.py --replace \"matrix_sso_helper\" \"$out/bin/matrix_sso_helper\" + ''; + + meta = with 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/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-notify-send/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-notify-send/default.nix new file mode 100644 index 000000000000..78f9fc082e31 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-notify-send/default.nix @@ -0,0 +1,31 @@ +{ lib, 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 lib; { + description = "A WeeChat script that sends highlight and message notifications through notify-send"; + homepage = "https://github.com/s3rvac/weechat-notify-send"; + license = licenses.mit; + maintainers = with maintainers; [ tobim ]; + }; +} diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix new file mode 100644 index 000000000000..987271e4ffa2 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/default.nix @@ -0,0 +1,70 @@ +{ lib, 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 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/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/weechat-otr/libpath.patch new file mode 100644 index 000000000000..a7b77ed9b602 --- /dev/null +++ b/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 + diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/zncplayback/default.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/zncplayback/default.nix new file mode 100644 index 000000000000..dcd74c0da0e8 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/scripts/zncplayback/default.nix @@ -0,0 +1,30 @@ +{ stdenv, lib, fetchurl }: + +stdenv.mkDerivation { + pname = "weechat-zncplayback"; + version = "0.1.0"; + + src = fetchurl { + url = "https://github.com/weechat/scripts/raw/643afdd25d29c2614cd67deb2388683cc270d686/python/zncplayback.py"; + sha256 = "1mz9pmnrqv2pjk4wz9yp1bic49m8qbf4nh7pg4j7vghmpq9srkd9"; + }; + + unpackPhase = '' + : + ''; + + installPhase = '' + mkdir -p $out/share + cp $src $out/share/zncplayback.py + ''; + + passthru = { + scripts = [ "zncplayback.py" ]; + }; + + meta = with lib; { + description = "Add support for the ZNC Playback module"; + licenses = licenses.gpl2Plus; + maintainers = with maintainers; [ qyliss ]; + }; +} diff --git a/nixpkgs/pkgs/applications/networking/irc/weechat/wrapper.nix b/nixpkgs/pkgs/applications/networking/irc/weechat/wrapper.nix new file mode 100644 index 000000000000..5c06bb8517a2 --- /dev/null +++ b/nixpkgs/pkgs/applications/networking/irc/weechat/wrapper.nix @@ -0,0 +1,91 @@ +{ lib, runCommand, writeScriptBin, buildEnv +, python3Packages, perlPackages, runtimeShell +}: + +weechat: + +let + wrapper = { + installManPages ? true + , configure ? { availablePlugins, ... }: { plugins = builtins.attrValues availablePlugins; } + }: + + let + perlInterpreter = perlPackages.perl; + availablePlugins = let + simplePlugin = name: {pluginFile = "${weechat.${name}}/lib/weechat/plugins/${name}.so";}; + in rec { + python = (simplePlugin "python") // { + extraEnv = '' + export PATH="${python3Packages.python}/bin:$PATH" + ''; + withPackages = pkgsFun: (python // { + extraEnv = '' + export PYTHONHOME="${python3Packages.python.withPackages pkgsFun}" + ''; + }); + }; + perl = (simplePlugin "perl") // { + extraEnv = '' + export PATH="${perlInterpreter}/bin:$PATH" + ''; + withPackages = pkgsFun: (perl // { + extraEnv = '' + ${perl.extraEnv} + export PERL5LIB=${perlPackages.makeFullPerlPath (pkgsFun perlPackages)} + ''; + }); + }; + tcl = simplePlugin "tcl"; + ruby = simplePlugin "ruby"; + guile = simplePlugin "guile"; + lua = simplePlugin "lua"; + }; + + config = configure { inherit availablePlugins; }; + + plugins = config.plugins or (builtins.attrValues availablePlugins); + + pluginsDir = runCommand "weechat-plugins" {} '' + mkdir -p $out/plugins + for plugin in ${lib.concatMapStringsSep " " (p: p.pluginFile) plugins} ; do + ln -s $plugin $out/plugins + done + ''; + + init = let + init = builtins.replaceStrings [ "\n" ] [ ";" ] (config.init or ""); + + mkScript = drv: lib.forEach drv.scripts (script: "/script load ${drv}/share/${script}"); + + scripts = builtins.concatStringsSep ";" (lib.foldl (scripts: drv: scripts ++ mkScript drv) + [ ] (config.scripts or [])); + in "${scripts};${init}"; + + mkWeechat = bin: (writeScriptBin bin '' + #!${runtimeShell} + export WEECHAT_EXTRA_LIBDIR=${pluginsDir} + ${lib.concatMapStringsSep "\n" (p: lib.optionalString (p ? extraEnv) p.extraEnv) plugins} + exec ${weechat}/bin/${bin} "$@" --run-command ${lib.escapeShellArg init} + '') // { + inherit (weechat) name man; + unwrapped = weechat; + outputs = [ "out" "man" ]; + }; + in buildEnv { + name = "weechat-bin-env-${weechat.version}"; + extraOutputsToInstall = lib.optionals installManPages [ "man" ]; + paths = [ + (mkWeechat "weechat") + (mkWeechat "weechat-headless") + (runCommand "weechat-out-except-bin" { } '' + mkdir $out + ln -sf ${weechat}/include $out/include + ln -sf ${weechat}/lib $out/lib + ln -sf ${weechat}/share $out/share + '') + ]; + meta = builtins.removeAttrs weechat.meta [ "outputsToInstall" ]; + }; + +in lib.makeOverridable wrapper |