rxvt-unicode: rewrite plugin system

This commit is contained in:
rnhmjoj 2020-01-08 22:58:44 +01:00
parent 7a15db35d8
commit 27b3df0840
No known key found for this signature in database
GPG Key ID: BFBAF4C975F76450
12 changed files with 70 additions and 51 deletions

View File

@ -0,0 +1,20 @@
{ callPackage }:
{
autocomplete-all-the-things = callPackage ./urxvt-autocomplete-all-the-things { };
bidi = callPackage ./urxvt-bidi { };
font-size = callPackage ./urxvt-font-size { };
perl = callPackage ./urxvt-perl { };
perls = callPackage ./urxvt-perls { };
tabbedex = callPackage ./urxvt-tabbedex { };
theme-switch = callPackage ./urxvt-theme-switch { };
vtwheel = callPackage ./urxvt-vtwheel { };
}

View File

@ -16,6 +16,8 @@ perlPackages.buildPerlPackage rec {
install -Dm555 misc/bidi "$out/lib/urxvt/perl/bidi"
'';
passthru.perlPackages = [ "self" ];
meta = with lib; {
description = "Text::Bidi Perl package using fribidi, providing a urxvt plugin";
homepage = "https://github.com/mkamensky/Text-Bidi";

View File

@ -0,0 +1,46 @@
{ callPackage
, symlinkJoin
, makeWrapper
, lib
, rxvt-unicode-unwrapped
, perlPackages
}:
let
availablePlugins = import ../rxvt-unicode-plugins { inherit callPackage; };
wrapper =
{ configure ? { availablePlugins, ... }:
{ plugins = builtins.attrValues availablePlugins;
extraDeps = [ ];
perlDeps = [ ];
}
}:
let
config = configure { inherit availablePlugins; };
plugins = config.plugins or (builtins.attrValues availablePlugins);
extraDeps = config.extraDeps or [ ];
perlDeps = (config.perlDeps or [ ]) ++ lib.concatMap (p: p.perlPackages or [ ]) plugins;
in
symlinkJoin {
name = "rxvt-unicode-${rxvt-unicode-unwrapped.version}";
paths = [ rxvt-unicode-unwrapped ] ++ plugins ++ extraDeps;
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/urxvt \
--prefix PERL5LIB : "${perlPackages.makePerlPath perlDeps}" \
--suffix-each URXVT_PERL_LIB ':' "$out/lib/urxvt/perl"
wrapProgram $out/bin/urxvtd \
--prefix PERL5LIB : "${perlPackages.makePerlPath perlDeps}" \
--suffix-each URXVT_PERL_LIB ':' "$out/lib/urxvt/perl"
'';
passthru.plugins = plugins;
};
in
lib.makeOverridable wrapper { }

View File

@ -1,23 +0,0 @@
{ symlinkJoin, rxvt_unicode, makeWrapper, plugins, perlPackages, perlDeps ? []}:
let
rxvt_name = builtins.parseDrvName rxvt_unicode.name;
in symlinkJoin {
name = "${rxvt_name.name}-with-plugins-${rxvt_name.version}";
paths = [ rxvt_unicode ] ++ plugins;
buildInputs = [ makeWrapper ];
postBuild = ''
wrapProgram $out/bin/urxvt \
--prefix PERL5LIB : "${perlPackages.makePerlPath perlDeps}" \
--suffix-each URXVT_PERL_LIB ':' "$out/lib/urxvt/perl"
wrapProgram $out/bin/urxvtd \
--prefix PERL5LIB : "${perlPackages.makePerlPath perlDeps}" \
--suffix-each URXVT_PERL_LIB ':' "$out/lib/urxvt/perl"
'';
passthru.plugins = plugins;
}

View File

@ -21229,35 +21229,9 @@ in
rxvt = callPackage ../applications/misc/rxvt { };
# urxvt
rxvt_unicode = callPackage ../applications/misc/rxvt_unicode { };
rxvt-unicode = callPackage ../applications/misc/rxvt-unicode/wrapper.nix { };
rxvt_unicode-with-plugins = callPackage ../applications/misc/rxvt_unicode/wrapper.nix {
plugins = [
urxvt_autocomplete_all_the_things
urxvt_perl
urxvt_perls
urxvt_tabbedex
urxvt_font_size
urxvt_theme_switch
urxvt_vtwheel
urxvt_bidi
];
perlDeps = [
# This needs the perl module it self provides
urxvt_bidi
];
};
# urxvt plugins
urxvt_autocomplete_all_the_things = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-autocomplete-all-the-things { };
urxvt_perl = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-perl { };
urxvt_perls = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-perls { };
urxvt_tabbedex = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-tabbedex { };
urxvt_font_size = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-font-size { };
urxvt_theme_switch = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-theme-switch { };
urxvt_vtwheel = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-vtwheel.nix { };
urxvt_bidi = callPackage ../applications/misc/rxvt_unicode-plugins/urxvt-bidi { };
rxvt-unicode-unwrapped = callPackage ../applications/misc/rxvt-unicode { };
uade123 = callPackage ../applications/audio/uade123 {};