From 09e58bc4e71a11e674a6aa2a506d8c4024eba5d6 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Wed, 8 Aug 2018 17:55:43 +0200 Subject: [PATCH] weechat-xmpp: create proper runtime environment The `weechat-xmpp` plugin requires `pydns` to properly resolve the XMPP host. Furthermore it's much easier to use substituteAll rather than messing around with substituteInPlace in a patched file. --- .../instant-messengers/weechat-xmpp/default.nix | 17 ++++++++--------- .../weechat-xmpp/libpath.patch | 2 +- pkgs/top-level/all-packages.nix | 4 +++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/weechat-xmpp/default.nix b/pkgs/applications/networking/instant-messengers/weechat-xmpp/default.nix index 8c7e80b3ff8..4b92d1212c5 100644 --- a/pkgs/applications/networking/instant-messengers/weechat-xmpp/default.nix +++ b/pkgs/applications/networking/instant-messengers/weechat-xmpp/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, xmpppy }: +{ stdenv, fetchFromGitHub, xmpppy, pydns, substituteAll, buildEnv }: stdenv.mkDerivation { name = "weechat-jabber-2017-08-30"; @@ -15,15 +15,14 @@ stdenv.mkDerivation { cp jabber.py $out/share/jabber.py ''; - buildInputs = [ xmpppy ]; - - postPatch = '' - substituteInPlace jabber.py \ - --replace "__NIX_OUTPUT__" "${xmpppy}/lib/python2.7/site-packages" - ''; - patches = [ - ./libpath.patch + (substituteAll { + src = ./libpath.patch; + env = "${buildEnv { + name = "weechat-xmpp-env"; + paths = [ pydns xmpppy ]; + }}/lib/python2.7/site-packages"; + }) ]; meta = with stdenv.lib; { diff --git a/pkgs/applications/networking/instant-messengers/weechat-xmpp/libpath.patch b/pkgs/applications/networking/instant-messengers/weechat-xmpp/libpath.patch index d3faab33a8e..372c83944a2 100644 --- a/pkgs/applications/networking/instant-messengers/weechat-xmpp/libpath.patch +++ b/pkgs/applications/networking/instant-messengers/weechat-xmpp/libpath.patch @@ -8,7 +8,7 @@ index 27006a3..e53c2c0 100644 +import sys + -+sys.path.append('__NIX_OUTPUT__') ++sys.path.append('@env@') + + import_ok = True diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 09fb1ff28c9..7d95390cc43 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -18982,7 +18982,9 @@ with pkgs; inherit (luaPackages) cjson; }; - weechat-xmpp = callPackage ../applications/networking/instant-messengers/weechat-xmpp {}; + weechat-xmpp = callPackage ../applications/networking/instant-messengers/weechat-xmpp { + inherit (pythonPackages) pydns; + }; westonLite = weston.override { pango = null;