From 27b3df08400daa2c98564be99abfef46d0b1663a Mon Sep 17 00:00:00 2001 From: rnhmjoj Date: Wed, 8 Jan 2020 22:58:44 +0100 Subject: [PATCH] rxvt-unicode: rewrite plugin system --- .../misc/rxvt-unicode-plugins/default.nix | 20 ++++++++ .../default.nix | 0 .../urxvt-bidi/default.nix | 2 + .../urxvt-font-size/default.nix | 0 .../urxvt-perl/default.nix | 0 .../urxvt-perls/default.nix | 0 .../urxvt-tabbedex/default.nix | 0 .../urxvt-theme-switch/default.nix | 0 .../urxvt-vtwheel/default.nix} | 0 .../misc/rxvt-unicode/wrapper.nix | 46 +++++++++++++++++++ .../misc/rxvt_unicode/wrapper.nix | 23 ---------- pkgs/top-level/all-packages.nix | 30 +----------- 12 files changed, 70 insertions(+), 51 deletions(-) create mode 100644 pkgs/applications/misc/rxvt-unicode-plugins/default.nix rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-autocomplete-all-the-things/default.nix (100%) rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-bidi/default.nix (95%) rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-font-size/default.nix (100%) rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-perl/default.nix (100%) rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-perls/default.nix (100%) rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-tabbedex/default.nix (100%) rename pkgs/applications/misc/{rxvt_unicode-plugins => rxvt-unicode-plugins}/urxvt-theme-switch/default.nix (100%) rename pkgs/applications/misc/{rxvt_unicode-plugins/urxvt-vtwheel.nix => rxvt-unicode-plugins/urxvt-vtwheel/default.nix} (100%) create mode 100644 pkgs/applications/misc/rxvt-unicode/wrapper.nix delete mode 100644 pkgs/applications/misc/rxvt_unicode/wrapper.nix diff --git a/pkgs/applications/misc/rxvt-unicode-plugins/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/default.nix new file mode 100644 index 000000000000..b8a481fd1201 --- /dev/null +++ b/pkgs/applications/misc/rxvt-unicode-plugins/default.nix @@ -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 { }; + +} diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-autocomplete-all-the-things/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-autocomplete-all-the-things/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-autocomplete-all-the-things/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-autocomplete-all-the-things/default.nix diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-bidi/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-bidi/default.nix similarity index 95% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-bidi/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-bidi/default.nix index 3e67e4ec085f..4b6b4eb8184c 100644 --- a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-bidi/default.nix +++ b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-bidi/default.nix @@ -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"; diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-font-size/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-font-size/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-font-size/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-font-size/default.nix diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-perl/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-perl/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-perl/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-perl/default.nix diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-perls/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-perls/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-perls/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-perls/default.nix diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-tabbedex/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-tabbedex/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-tabbedex/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-tabbedex/default.nix diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-theme-switch/default.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-theme-switch/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-theme-switch/default.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-theme-switch/default.nix diff --git a/pkgs/applications/misc/rxvt_unicode-plugins/urxvt-vtwheel.nix b/pkgs/applications/misc/rxvt-unicode-plugins/urxvt-vtwheel/default.nix similarity index 100% rename from pkgs/applications/misc/rxvt_unicode-plugins/urxvt-vtwheel.nix rename to pkgs/applications/misc/rxvt-unicode-plugins/urxvt-vtwheel/default.nix diff --git a/pkgs/applications/misc/rxvt-unicode/wrapper.nix b/pkgs/applications/misc/rxvt-unicode/wrapper.nix new file mode 100644 index 000000000000..8a833f234094 --- /dev/null +++ b/pkgs/applications/misc/rxvt-unicode/wrapper.nix @@ -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 { } diff --git a/pkgs/applications/misc/rxvt_unicode/wrapper.nix b/pkgs/applications/misc/rxvt_unicode/wrapper.nix deleted file mode 100644 index fd0860b3aaef..000000000000 --- a/pkgs/applications/misc/rxvt_unicode/wrapper.nix +++ /dev/null @@ -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; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index afad70ae6022..62e3eb8d4bcb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 {};