weechat: fix bad merge

Identified in 8887e1f697 (r239097413).

9504292b1e9948fb286b1b1cdbe83f66b367b64d accidentally reverted all the
changes that had been made to the weechat wrapper since
8887e1f697d9e13ad277ca7d7054bc42c2459548.

I removed the wrapper, then wrote it again, but this time taking the
code from the latest version of weechat before the bad merge.
This commit is contained in:
Alyssa Ross 2018-12-05 15:18:27 +00:00
parent d362815113
commit 6dc9347712
No known key found for this signature in database
GPG Key ID: C4844408C0657052

@ -1,4 +1,5 @@
{ pythonPackages, perl, runCommand, lib, writeScriptBin, stdenv { stdenv, lib, runCommand, writeScriptBin, buildEnv
, pythonPackages, perl, perlPackages
}: }:
weechat: weechat:
@ -10,31 +11,37 @@ let
let let
perlInterpreter = perl; perlInterpreter = perl;
config = configure { availablePlugins = let
availablePlugins = let simplePlugin = name: {pluginFile = "${weechat.${name}}/lib/weechat/plugins/${name}.so";};
simplePlugin = name: { pluginFile = "${weechat.${name}}/lib/weechat/plugins/${name}.so"; }; in rec {
in rec { python = {
python = { pluginFile = "${weechat.python}/lib/weechat/plugins/python.so";
pluginFile = "${weechat.python}/lib/weechat/plugins/python.so"; withPackages = pkgsFun: (python // {
withPackages = pkgsFun: (python // {
extraEnv = ''
export PYTHONHOME="${pythonPackages.python.withPackages pkgsFun}"
'';
});
};
perl = (simplePlugin "perl") // {
extraEnv = '' extraEnv = ''
export PATH="${perlInterpreter}/bin:$PATH" export PYTHONHOME="${pythonPackages.python.withPackages pkgsFun}"
''; '';
}; });
tcl = simplePlugin "tcl";
ruby = simplePlugin "ruby";
guile = simplePlugin "guile";
lua = simplePlugin "lua";
}; };
}; perl = (simplePlugin "perl") // {
extraEnv = ''
export PATH="${perlInterpreter}/bin:$PATH"
'';
withPackages = pkgsFun: (perl // {
extraEnv = ''
${perl.extraEnv}
export PERL5LIB=${lib.makeFullPerlPath (pkgsFun perlPackages)}
'';
});
};
tcl = simplePlugin "tcl";
ruby = simplePlugin "ruby";
guile = simplePlugin "guile";
lua = simplePlugin "lua";
};
inherit (config) plugins; config = configure { inherit availablePlugins; };
plugins = config.plugins or (builtins.attrValues availablePlugins);
pluginsDir = runCommand "weechat-plugins" {} '' pluginsDir = runCommand "weechat-plugins" {} ''
mkdir -p $out/plugins mkdir -p $out/plugins
@ -43,14 +50,30 @@ let
done done
''; '';
in (writeScriptBin "weechat" '' init = let
#!${stdenv.shell} init = builtins.replaceStrings [ "\n" ] [ ";" ] (config.init or "");
export WEECHAT_EXTRA_LIBDIR=${pluginsDir}
${lib.concatMapStringsSep "\n" (p: lib.optionalString (p ? extraEnv) p.extraEnv) plugins} mkScript = drv: lib.flip map drv.scripts (script: "/script load ${drv}/share/${script}");
exec ${weechat}/bin/weechat "$@"
'') // { scripts = builtins.concatStringsSep ";" (lib.foldl (scripts: drv: scripts ++ mkScript drv)
name = weechat.name; [ ] (config.scripts or []));
unwrapped = weechat; in "${scripts};${init}";
mkWeechat = bin: (writeScriptBin bin ''
#!${stdenv.shell}
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 meta;
unwrapped = weechat;
};
in buildEnv {
name = "weechat-bin-env-${weechat.version}";
paths = [
(mkWeechat "weechat")
(mkWeechat "weechat-headless")
];
meta = weechat.meta; meta = weechat.meta;
}; };