diff options
author | Alyssa Ross <hi@alyssa.is> | 2018-12-05 15:18:27 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2018-12-05 15:21:19 +0000 |
commit | 6dc9347712ca32c5c11b0b19ed43bea8d362ddf6 (patch) | |
tree | b59c5616dcb5572360f01f8592997c4c4f0b7c8a /pkgs/applications/networking/irc | |
parent | d362815113fc22d8361c927bcd27050f1e5f2487 (diff) | |
download | nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.tar nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.tar.gz nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.tar.bz2 nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.tar.lz nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.tar.xz nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.tar.zst nixlib-6dc9347712ca32c5c11b0b19ed43bea8d362ddf6.zip |
weechat: fix bad merge
Identified in https://github.com/NixOS/nixpkgs/pull/44102/commits/8887e1f697d9e13ad277ca7d7054bc42c2459548#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.
Diffstat (limited to 'pkgs/applications/networking/irc')
-rw-r--r-- | pkgs/applications/networking/irc/weechat/wrapper.nix | 83 |
1 files changed, 53 insertions, 30 deletions
diff --git a/pkgs/applications/networking/irc/weechat/wrapper.nix b/pkgs/applications/networking/irc/weechat/wrapper.nix index 5c557a8fd242..1e371bb8e223 100644 --- a/pkgs/applications/networking/irc/weechat/wrapper.nix +++ b/pkgs/applications/networking/irc/weechat/wrapper.nix @@ -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"; + }; + + config = configure { inherit availablePlugins; }; - inherit (config) plugins; + 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; }; |