uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,91 @@
{ 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 ? []
, fetchpatch
}:
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.5";
pname = "weechat";
hardeningEnable = [ "pie" ];
src = fetchurl {
url = "https://weechat.org/files/src/weechat-${version}.tar.bz2";
sha256 = "sha256-8ZSa2dQPTiChGW00T5OASHmd0C2PatUtTu9Gr4CF4Oc=";
};
outputs = [ "out" "man" ] ++ map (p: p.name) enabledPlugins;
cmakeFlags = with lib; [
"-DENABLE_MAN=ON"
"-DENABLE_DOC=OFF" # TODO: Documentation fails to build, was deactivated to push through security update
"-DENABLE_JAVASCRIPT=OFF" # Requires v8 <= 3.24.3, https://github.com/weechat/weechat/issues/360
"-DENABLE_PHP=OFF"
]
++ 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;
};
}

View file

@ -0,0 +1,26 @@
{ lib, stdenv, fetchurl, weechat }:
stdenv.mkDerivation {
pname = "buffer_autoset";
version = "1.2";
src = fetchurl {
url = "https://raw.githubusercontent.com/weechat/scripts/2b308b44df39ba6563d02b2bcd40c384ec2777dc/python/buffer_autoset.py";
sha256 = "0csl3sfpijdbq1j6wabx347lvn91a24a2jfx5b5pspfxz7gixli1";
};
dontUnpack = true;
passthru.scripts = [ "buffer_autoset.py" ];
installPhase = ''
install -D $src $out/share/buffer_autoset.py
'';
meta = with lib; {
inherit (weechat.meta) platforms;
description = "buffer_autoset.py is a weechat script which auto-set buffer properties when a buffer is opened.";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ govanify ];
};
}

View file

@ -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 ];
};
}

View file

@ -0,0 +1,35 @@
{ callPackage, luaPackages, perlPackages, python3Packages }:
{
colorize_nicks = callPackage ./colorize_nicks { };
edit = callPackage ./edit { };
multiline = callPackage ./multiline {
inherit (perlPackages) PodParser;
};
url_hint = callPackage ./url_hint { };
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 { };
weechat-go = callPackage ./weechat-go { };
buffer_autoset = callPackage ./buffer_autoset { };
highmon = callPackage ./highmon { };
zncplayback = callPackage ./zncplayback { };
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchFromGitHub, weechat }:
stdenv.mkDerivation rec {
pname = "edit-weechat";
version = "1.0.2";
src = fetchFromGitHub {
owner = "keith";
repo = "edit-weechat";
rev = version;
sha256 = "1s42r0l0xkhlp6rbc23cm4vlda91il6cg53w33hqfhd2wz91s66w";
};
dontBuild = true;
passthru.scripts = [ "edit.py" ];
installPhase = ''
runHook preInstall
install -D edit.py $out/share/edit.py
runHook postInstall
'';
meta = with lib; {
inherit (weechat.meta) platforms;
description = "This simple weechat plugin allows you to compose messages in your $EDITOR.";
license = licenses.mit;
maintainers = with maintainers; [ eraserhd ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchurl, weechat }:
stdenv.mkDerivation {
pname = "highmon";
version = "2.7";
src = fetchurl {
url = "https://raw.githubusercontent.com/KenjiE20/highmon/182e67d070c75efc81999e68c2ac7fdfe44d2872/highmon.pl";
sha256 = "1vvgzscb12l3cp2nq954fx6j3awvpjsb0nqylal51ps9cq9a3wir";
};
dontUnpack = true;
passthru.scripts = [ "highmon.pl" ];
installPhase = ''
runHook preInstall
install -D $src $out/share/highmon.pl
runHook postInstall
'';
meta = with lib; {
inherit (weechat.meta) platforms;
homepage = "https://github.com/KenjiE20/highmon/";
description = "highmon.pl is a weechat script that adds 'Highlight Monitor'.";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ govanify ];
};
}

View file

@ -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 ];
};
}

View file

@ -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;

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl, weechat }:
stdenv.mkDerivation {
pname = "url_hint";
version = "0.8";
src = fetchurl {
url = "https://raw.githubusercontent.com/weechat/scripts/10671d785ea3f9619d0afd0d7a1158bfa4ee3938/python/url_hint.py";
sha256 = "0aw59kq74yqh0qbdkldfl6l83d0bz833232xr2w4741szck43kss";
};
dontUnpack = true;
passthru.scripts = [ "url_hint.py" ];
installPhase = ''
runHook preInstall
install -D $src $out/share/url_hint.py
runHook postInstall
'';
meta = with lib; {
inherit (weechat.meta) platforms;
description = "url_hint.py is a URL opening script.";
license = licenses.mit;
maintainers = with maintainers; [ eraserhd ];
};
}

View file

@ -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..
'';
};
}

View file

@ -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,

View file

@ -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(

View file

@ -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 ];
};
}

View file

@ -0,0 +1,26 @@
{ lib, stdenv, fetchurl, weechat }:
stdenv.mkDerivation {
pname = "weechat-go";
version = "2.7";
src = fetchurl {
url = "https://github.com/weechat/scripts/raw/414cff3ee605ba204b607742430a21443c035b08/python/go.py";
sha256 = "0bnbfpj1qg4yzwbikh1aw5ajc8l44lkb0y0m6mz8grpf5bxk5cwm";
};
dontUnpack = true;
passthru.scripts = [ "go.py" ];
installPhase = ''
install -D $src $out/share/go.py
'';
meta = with lib; {
inherit (weechat.meta) platforms;
description = "go.py is a weechat script to quickly jump to different buffers";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ govanify ];
};
}

View file

@ -0,0 +1,51 @@
{ lib, stdenv, curl, fetchFromGitHub, cjson, olm, luaffi }:
stdenv.mkDerivation {
pname = "weechat-matrix-bridge";
version = "unstable-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;
};
}

View file

@ -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[[

View file

@ -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.3.0";
in buildPythonPackage {
pname = "weechat-matrix";
inherit version;
src = fetchFromGitHub {
owner = "poljar";
repo = "weechat-matrix";
rev = version;
hash = "sha256-o4kgneszVLENG167nWnk2FxM+PsMzi+PSyMUMIktZcc=";
};
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 ];
};
}

View file

@ -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 ];
};
}

View file

@ -0,0 +1,77 @@
{ 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 ];
# Tests are relying on old Python 2 modules.
doCheck = false;
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";
knownVulnerabilities = [
"There is no upstream release since 2018-03."
"Utilizes deprecated and vulnerable pycrypto library with Debian patches from 2020-04."
];
};
}

View file

@ -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

View file

@ -0,0 +1,28 @@
{ lib, stdenv, fetchurl }:
stdenv.mkDerivation {
pname = "weechat-zncplayback";
version = "0.2.1";
src = fetchurl {
url = "https://github.com/weechat/scripts/raw/bcc9643136addd2cd68ac957dd64e336e4f88aa1/python/zncplayback.py";
sha256 = "1k32p6naxg40g664ip48zvm61xza7l9az3v3rawmjw97i0mwz7y3";
};
dontUnpack = true;
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";
license = licenses.gpl2Plus;
maintainers = with maintainers; [ qyliss ];
};
}

View file

@ -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