Merge pull request #44102 from alyssais/weechat-unwrapped
weechat: seperate weechat-unwrapped from wrapper
This commit is contained in:
commit
3e1401f06b
@ -2,7 +2,6 @@
|
||||
, ncurses, openssl, aspell, gnutls
|
||||
, zlib, curl, pkgconfig, libgcrypt
|
||||
, cmake, makeWrapper, libobjc, libresolv, libiconv
|
||||
, writeScriptBin # for withPlugins
|
||||
, asciidoctor # manpages
|
||||
, guileSupport ? true, guile
|
||||
, luaSupport ? true, lua5
|
||||
@ -11,8 +10,6 @@
|
||||
, rubySupport ? true, ruby
|
||||
, tclSupport ? true, tcl
|
||||
, extraBuildInputs ? []
|
||||
, configure ? { availablePlugins, ... }: { plugins = builtins.attrValues availablePlugins; }
|
||||
, runCommand, buildEnv
|
||||
}:
|
||||
|
||||
let
|
||||
@ -27,7 +24,7 @@ let
|
||||
];
|
||||
enabledPlugins = builtins.filter (p: p.enabled) plugins;
|
||||
|
||||
weechat =
|
||||
in
|
||||
assert lib.all (p: p.enabled -> ! (builtins.elem null p.buildInputs)) plugins;
|
||||
stdenv.mkDerivation rec {
|
||||
version = "2.3";
|
||||
@ -82,72 +79,4 @@ let
|
||||
maintainers = with stdenv.lib.maintainers; [ lovek323 garbas the-kenny lheckemann ma27 ];
|
||||
platforms = stdenv.lib.platforms.unix;
|
||||
};
|
||||
};
|
||||
in if configure == null then weechat else
|
||||
let
|
||||
perlInterpreter = 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 PYTHONHOME="${pythonPackages.python.withPackages pkgsFun}"
|
||||
'';
|
||||
});
|
||||
};
|
||||
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";
|
||||
};
|
||||
|
||||
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.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;
|
||||
}
|
||||
}
|
||||
|
57
pkgs/applications/networking/irc/weechat/wrapper.nix
Normal file
57
pkgs/applications/networking/irc/weechat/wrapper.nix
Normal file
@ -0,0 +1,57 @@
|
||||
{ pythonPackages, perl, runCommand, lib, writeScriptBin, stdenv
|
||||
}:
|
||||
|
||||
weechat:
|
||||
|
||||
let
|
||||
wrapper = {
|
||||
configure ? { availablePlugins, ... }: { plugins = builtins.attrValues availablePlugins; }
|
||||
}:
|
||||
|
||||
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") // {
|
||||
extraEnv = ''
|
||||
export PATH="${perlInterpreter}/bin:$PATH"
|
||||
'';
|
||||
};
|
||||
tcl = simplePlugin "tcl";
|
||||
ruby = simplePlugin "ruby";
|
||||
guile = simplePlugin "guile";
|
||||
lua = simplePlugin "lua";
|
||||
};
|
||||
};
|
||||
|
||||
inherit (config) plugins;
|
||||
|
||||
pluginsDir = runCommand "weechat-plugins" {} ''
|
||||
mkdir -p $out/plugins
|
||||
for plugin in ${lib.concatMapStringsSep " " (p: p.pluginFile) plugins} ; do
|
||||
ln -s $plugin $out/plugins
|
||||
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;
|
||||
meta = weechat.meta;
|
||||
};
|
||||
|
||||
in lib.makeOverridable wrapper
|
@ -19738,12 +19738,16 @@ in
|
||||
|
||||
webtorrent_desktop = callPackage ../applications/video/webtorrent_desktop {};
|
||||
|
||||
weechat = callPackage ../applications/networking/irc/weechat {
|
||||
wrapWeechat = callPackage ../applications/networking/irc/weechat/wrapper.nix { };
|
||||
|
||||
weechat-unwrapped = callPackage ../applications/networking/irc/weechat {
|
||||
inherit (darwin) libobjc;
|
||||
inherit (darwin) libresolv;
|
||||
guile = guile_2_0;
|
||||
};
|
||||
|
||||
weechat = wrapWeechat weechat-unwrapped { };
|
||||
|
||||
weechatScripts = callPackage ../applications/networking/irc/weechat/scripts { };
|
||||
|
||||
westonLite = weston.override {
|
||||
|
Loading…
x
Reference in New Issue
Block a user