Merge pull request #51571 from alyssais/weechat-merge

weechat: fix bad merge
This commit is contained in:
Maximilian Bosch 2018-12-06 01:40:24 +01:00 committed by GitHub
commit 42356feed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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