2018-07-21 00:44:44 +00:00
|
|
|
{ stdenv, fetchurl, lib
|
2017-11-03 10:25:22 +00:00
|
|
|
, ncurses, openssl, aspell, gnutls
|
|
|
|
, zlib, curl, pkgconfig, libgcrypt
|
2016-10-20 12:28:27 +00:00
|
|
|
, cmake, makeWrapper, libobjc, libresolv, libiconv
|
2016-10-14 21:30:38 +00:00
|
|
|
, asciidoctor # manpages
|
2016-02-18 06:07:23 +00:00
|
|
|
, guileSupport ? true, guile
|
|
|
|
, luaSupport ? true, lua5
|
2018-10-23 10:23:47 +00:00
|
|
|
, perlSupport ? true, perl, perlPackages
|
2017-11-03 10:25:22 +00:00
|
|
|
, pythonSupport ? true, pythonPackages
|
2016-02-18 06:07:23 +00:00
|
|
|
, rubySupport ? true, ruby
|
|
|
|
, tclSupport ? true, tcl
|
2017-11-03 10:25:22 +00:00
|
|
|
, extraBuildInputs ? []
|
2018-09-05 15:01:45 +00:00
|
|
|
}:
|
2016-02-18 06:07:23 +00:00
|
|
|
|
|
|
|
let
|
2018-07-20 19:36:12 +00:00
|
|
|
inherit (pythonPackages) python;
|
2017-11-03 10:25:22 +00:00
|
|
|
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_PYTHON"; buildInputs = [ python ]; }
|
|
|
|
];
|
|
|
|
enabledPlugins = builtins.filter (p: p.enabled) plugins;
|
2016-02-18 06:07:23 +00:00
|
|
|
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 16:36:41 +00:00
|
|
|
in
|
2017-11-03 10:25:22 +00:00
|
|
|
assert lib.all (p: p.enabled -> ! (builtins.elem null p.buildInputs)) plugins;
|
|
|
|
stdenv.mkDerivation rec {
|
2018-10-25 11:42:48 +00:00
|
|
|
version = "2.3";
|
2017-11-03 10:25:22 +00:00
|
|
|
name = "weechat-${version}";
|
2010-08-05 15:47:15 +00:00
|
|
|
|
2017-11-03 10:25:22 +00:00
|
|
|
src = fetchurl {
|
2018-10-25 11:42:48 +00:00
|
|
|
url = "https://weechat.org/files/src/weechat-${version}.tar.bz2";
|
|
|
|
sha256 = "0mi4pfnyny0vqc35r0scn6yy21y790a5iwq8ms7kch7b7z11jn9w";
|
2017-11-03 10:25:22 +00:00
|
|
|
};
|
2010-08-05 15:47:15 +00:00
|
|
|
|
2017-11-03 10:25:22 +00:00
|
|
|
outputs = [ "out" "man" ] ++ map (p: p.name) enabledPlugins;
|
2015-08-21 21:02:39 +00:00
|
|
|
|
2017-11-03 10:25:22 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
cmakeFlags = with stdenv.lib; [
|
|
|
|
"-DENABLE_MAN=ON"
|
|
|
|
"-DENABLE_DOC=ON"
|
2016-10-14 21:30:38 +00:00
|
|
|
]
|
2017-11-03 10:25:22 +00:00
|
|
|
++ optionals stdenv.isDarwin ["-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib" "-DCMAKE_FIND_FRAMEWORK=LAST"]
|
|
|
|
++ map (p: "-D${p.cmakeFlag}=" + (if p.enabled then "ON" else "OFF")) plugins
|
|
|
|
;
|
|
|
|
|
|
|
|
buildInputs = with stdenv.lib; [
|
|
|
|
ncurses openssl aspell gnutls zlib curl pkgconfig
|
|
|
|
libgcrypt makeWrapper cmake asciidoctor
|
|
|
|
]
|
|
|
|
++ 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
|
|
|
|
+ (stdenv.lib.optionalString stdenv.isDarwin "-DBIND_8_COMPAT=1 -lresolv");
|
|
|
|
|
|
|
|
postInstall = with stdenv.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
|
|
|
|
'';
|
2010-08-05 15:47:15 +00:00
|
|
|
|
2017-11-03 10:25:22 +00:00
|
|
|
meta = {
|
|
|
|
homepage = http://www.weechat.org/;
|
|
|
|
description = "A fast, light and extensible chat client";
|
2018-04-04 12:42:06 +00:00
|
|
|
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 .
|
|
|
|
'';
|
2017-11-03 10:25:22 +00:00
|
|
|
license = stdenv.lib.licenses.gpl3;
|
2018-09-05 15:01:45 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ lovek323 garbas the-kenny lheckemann ma27 ];
|
2017-11-03 10:25:22 +00:00
|
|
|
platforms = stdenv.lib.platforms.unix;
|
|
|
|
};
|
weechat: seperate weechat-unwrapped from wrapper
If I have a patch I want to apply to weechat, I can't do that with
overrideAttrs like I can with almost every other package, because that
only applies to the wrapper derivation. For other wrapped packages, one
can usually call the wrapper with any version of the derivation, but the
weechat derivation didn't expose a wrapper creation function.
Taking inspiration from other packages, particularly Firefox, I
extracted the wrapper into its own function, made the default weechat
derivation use that, and added weechat-unwrapped.
Now I can add my custom patch like this:
(wrapWeechat
(weechat-unwrapped.overrideAttrs (oldAttrs: {
patches = [
(fetchpatch {
url = "https://github.com/weechat/weechat/commit/55767f5f116db3cb56cf85f52aa80feff45b6abf.patch?full_index=1";
sha256 = "1pkcdsby57diqds1y5hhl0fr4i8j0zax32jb0gqd36siki3lza3d";
})
];
}))
{ configure =
{ availablePlugins, ... }:
{
plugins = with availablePlugins; [
(python.withPackages (packages: with packages; [ potr websocket_client ]))
];
};
})
There is a small backward incompatibility here: previously, it was
possible to get an unwrapped weechat like this:
weechat.override { configure = null; }
This didn't seem too important to keep around since it was also possible
to get an unwrapped weechat in a much more obvious way:
weechat.unwrapped
I could probably make it so that the first way still worked, if that
behavior turns out to really have been important.
2018-07-25 16:36:41 +00:00
|
|
|
}
|