Merge pull request #77347 from rnhmjoj/urxvt
rxvt-unicode: rewrite plugin system
This commit is contained in:
commit
565724c775
|
@ -18,6 +18,7 @@
|
|||
<xi:include href="opengl.xml" />
|
||||
<xi:include href="shell-helpers.xml" />
|
||||
<xi:include href="steam.xml" />
|
||||
<xi:include href="urxvt.xml" />
|
||||
<xi:include href="weechat.xml" />
|
||||
<xi:include href="xorg.xml" />
|
||||
</chapter>
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
<section xmlns="http://docbook.org/ns/docbook"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:id="sec-urxvt">
|
||||
<title>Urxvt</title>
|
||||
|
||||
<para>
|
||||
Urxvt, also known as rxvt-unicode, is a highly customizable terminal emulator.
|
||||
</para>
|
||||
|
||||
<section xml:id="sec-urxvt-conf">
|
||||
|
||||
<title>Configuring urxvt</title>
|
||||
|
||||
<para>
|
||||
In <literal>nixpkgs</literal>, urxvt is provided by the package
|
||||
<literal>rxvt-unicode</literal>. It can be configured to include your choice
|
||||
of plugins, reducing its closure size from the default configuration which
|
||||
includes all available plugins. To make use of this functionality, use an
|
||||
overlay or directly install an expression that overrides its configuration,
|
||||
such as
|
||||
<programlisting>rxvt-unicode.override { configure = { availablePlugins, ... }: {
|
||||
plugins = with availablePlugins; [ perls resize-font vtwheel ];
|
||||
}
|
||||
}</programlisting>
|
||||
If the <literal>configure</literal> function returns an attrset without the
|
||||
<literal>plugins</literal> attribute, <literal>availablePlugins</literal>
|
||||
will be used automatically.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In order to add plugins but also keep all default plugins installed, it is
|
||||
possible to use the following method:
|
||||
<programlisting>rxvt-unicode.override { configure = { availablePlugins, ... }: {
|
||||
plugins = (builtins.attrValues availablePlugins) ++ [ custom-plugin ];
|
||||
};
|
||||
}</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To get a list of all the plugins available, open the Nix REPL and run
|
||||
<programlisting>$ nix repl
|
||||
:l <nixpkgs>
|
||||
map (p: p.name) pkgs.rxvt-unicode.plugins
|
||||
</programlisting>
|
||||
Alternatively, if your shell is bash or zsh and have completion enabled,
|
||||
simply type <literal>nixpkgs.rxvt-unicode.plugins.<tab></literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In addition to <literal>plugins</literal> the options
|
||||
<literal>extraDeps</literal> and <literal>perlDeps</literal> can be used
|
||||
to install extra packages.
|
||||
<literal>extraDeps</literal> can be used, for example, to provide
|
||||
<literal>xsel</literal> (a clipboard manager) to the clipboard plugin,
|
||||
without installing it globally:
|
||||
<programlisting>rxvt-unicode.override { configure = { availablePlugins, ... }: {
|
||||
pluginsDeps = [ xsel ];
|
||||
}
|
||||
}</programlisting>
|
||||
|
||||
<literal>perlDeps</literal> is a handy way to provide Perl packages to
|
||||
your custom plugins (in <literal>$HOME/.urxvt/ext</literal>). For example,
|
||||
if you need <literal>AnyEvent</literal> you can do:
|
||||
<programlisting>rxvt-unicode.override { configure = { availablePlugins, ... }: {
|
||||
perlDeps = with perlPackages; [ AnyEvent ];
|
||||
}
|
||||
}</programlisting>
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<section xml:id="sec-urxvt-pkg">
|
||||
|
||||
<title>Packaging urxvt plugins</title>
|
||||
|
||||
<para>
|
||||
Urxvt plugins resides in
|
||||
<literal>pkgs/applications/misc/rxvt-unicode-plugins</literal>.
|
||||
To add a new plugin create an expression in a subdirectory and add the
|
||||
package to the set in
|
||||
<literal>pkgs/applications/misc/rxvt-unicode-plugins/default.nix</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A plugin can be any kind of derivation, the only requirement is that it
|
||||
should always install perl scripts in <literal>$out/lib/urxvt/perl</literal>.
|
||||
Look for existing plugins for examples.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If the plugin is itself a perl package that needs to be imported from
|
||||
other plugins or scripts, add the following passthrough:
|
||||
<programlisting>passthru.perlPackages = [ "self" ];
|
||||
</programlisting>
|
||||
This will make the urxvt wrapper pick up the dependency and set up the perl
|
||||
path accordingly.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
|
@ -0,0 +1,22 @@
|
|||
{ 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 { };
|
||||
|
||||
resize-font = callPackage ./urxvt-resize-font { };
|
||||
|
||||
tabbedex = callPackage ./urxvt-tabbedex { };
|
||||
|
||||
theme-switch = callPackage ./urxvt-theme-switch { };
|
||||
|
||||
vtwheel = callPackage ./urxvt-vtwheel { };
|
||||
|
||||
}
|
|
@ -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";
|
|
@ -0,0 +1,27 @@
|
|||
{ stdenv, fetchFromGitHub }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "urxvt-resize-font";
|
||||
version = "2019-10-05";
|
||||
dontPatchShebangs = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "simmel";
|
||||
repo = "urxvt-resize-font";
|
||||
rev = "e966a5d77264e9263bfc8a51e160fad24055776b";
|
||||
sha256 = "18ab3bsfdkzzh1n9fpi2al5bksvv2b7fjmvxpx6fzqcy4bc64vkh";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/urxvt/perl
|
||||
cp resize-font $out/lib/urxvt/perl
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "URxvt Perl extension for resizing the font";
|
||||
homepage = "https://github.com/simmel/urxvt-resize-font";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ rnhmjoj ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
{ stdenv, fetchurl, makeDesktopItem
|
||||
, libX11, libXt, libXft, libXrender
|
||||
, ncurses, fontconfig, freetype
|
||||
, pkgconfig, gdk-pixbuf, perl
|
||||
, perlSupport ? true
|
||||
, gdkPixbufSupport ? true
|
||||
, unicode3Support ? true
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "rxvt-unicode";
|
||||
version = "9.22";
|
||||
description = "A clone of the well-known terminal emulator rxvt";
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = pname;
|
||||
exec = "urxvt";
|
||||
icon = "utilities-terminal";
|
||||
comment = description;
|
||||
desktopName = "URxvt";
|
||||
genericName = pname;
|
||||
categories = "System;TerminalEmulator;";
|
||||
};
|
||||
in
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "${pname}-unwrapped-${version}";
|
||||
inherit pname version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${version}.tar.bz2";
|
||||
sha256 = "1pddjn5ynblwfrdmskylrsxb9vfnk3w4jdnq2l8xn2pspkljhip9";
|
||||
};
|
||||
|
||||
buildInputs =
|
||||
[ libX11 libXt libXft ncurses # required to build the terminfo file
|
||||
fontconfig freetype pkgconfig libXrender
|
||||
] ++ optional perlSupport perl
|
||||
++ optional gdkPixbufSupport gdk-pixbuf;
|
||||
|
||||
outputs = [ "out" "terminfo" ];
|
||||
|
||||
patches = [
|
||||
./patches/9.06-font-width.patch
|
||||
./patches/256-color-resources.patch
|
||||
] ++ optional stdenv.isDarwin ./patches/makefile-phony.patch;
|
||||
|
||||
|
||||
configureFlags = [
|
||||
"--with-terminfo=$terminfo/share/terminfo"
|
||||
"--enable-256-color"
|
||||
(enableFeature perlSupport "perl")
|
||||
(enableFeature unicode3Support "unicode3")
|
||||
];
|
||||
|
||||
LDFLAGS = [ "-lfontconfig" "-lXrender" "-lpthread" ];
|
||||
CFLAGS = [ "-I${freetype.dev}/include/freetype2" ];
|
||||
|
||||
preConfigure =
|
||||
''
|
||||
# without this the terminfo won't be compiled by tic, see man tic
|
||||
mkdir -p $terminfo/share/terminfo
|
||||
export TERMINFO=$terminfo/share/terminfo
|
||||
''
|
||||
+ stdenv.lib.optionalString perlSupport ''
|
||||
# make urxvt find its perl file lib/perl5/site_perl
|
||||
# is added to PERL5LIB automatically
|
||||
mkdir -p $out/$(dirname ${perl.libPrefix})
|
||||
ln -s $out/lib/urxvt $out/${perl.libPrefix}
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
|
||||
cp -r ${desktopItem}/share/applications/ $out/share/
|
||||
'';
|
||||
|
||||
meta = {
|
||||
inherit description;
|
||||
homepage = "http://software.schmorp.de/pkg/rxvt-unicode.html";
|
||||
downloadPage = "http://dist.schmorp.de/rxvt-unicode/Attic/";
|
||||
maintainers = with maintainers; [ rnhmjoj ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.gpl3;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
{ callPackage
|
||||
, symlinkJoin
|
||||
, makeWrapper
|
||||
, lib
|
||||
, rxvt-unicode-unwrapped
|
||||
, rxvt-unicode-plugins
|
||||
, perlPackages
|
||||
, configure ? { availablePlugins, ... }:
|
||||
{ plugins = builtins.attrValues availablePlugins;
|
||||
extraDeps = [ ];
|
||||
perlDeps = [ ];
|
||||
}
|
||||
}:
|
||||
|
||||
let
|
||||
availablePlugins = rxvt-unicode-plugins;
|
||||
|
||||
# Transform the string "self" to the plugin itself.
|
||||
# It's needed for plugins like bidi who depends on the perl
|
||||
# package they provide themself.
|
||||
mkPerlDeps = p:
|
||||
let deps = p.perlPackages or [ ];
|
||||
in map (x: if x == "self" then p else x) deps;
|
||||
|
||||
# The wrapper is called with a `configure` function
|
||||
# that takes the urxvt plugins as input and produce
|
||||
# the configuration of the wrapper: list of plugins,
|
||||
# extra dependencies and perl dependencies.
|
||||
# This provides simple way to customize urxvt using
|
||||
# the `.override` mechanism.
|
||||
wrapper = { configure, ... }:
|
||||
let
|
||||
config = configure { inherit availablePlugins; };
|
||||
plugins = config.plugins or (builtins.attrValues availablePlugins);
|
||||
extraDeps = config.extraDeps or [ ];
|
||||
perlDeps = (config.perlDeps or [ ]) ++ lib.concatMap mkPerlDeps 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 { inherit configure; }
|
|
@ -1,72 +0,0 @@
|
|||
{ stdenv, fetchurl, makeDesktopItem, perlSupport ? true, libX11, libXt, libXft,
|
||||
ncurses, perl, fontconfig, freetype, pkgconfig, libXrender,
|
||||
gdkPixbufSupport ? true, gdk-pixbuf, unicode3Support ? true }:
|
||||
|
||||
let
|
||||
pname = "rxvt-unicode";
|
||||
version = "9.22";
|
||||
description = "A clone of the well-known terminal emulator rxvt";
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
name = pname;
|
||||
exec = "urxvt";
|
||||
icon = "utilities-terminal";
|
||||
comment = description;
|
||||
desktopName = "URxvt";
|
||||
genericName = pname;
|
||||
categories = "System;TerminalEmulator;";
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
|
||||
name = "${pname}${if perlSupport then "-with-perl" else ""}${if unicode3Support then "-with-unicode3" else ""}-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${version}.tar.bz2";
|
||||
sha256 = "1pddjn5ynblwfrdmskylrsxb9vfnk3w4jdnq2l8xn2pspkljhip9";
|
||||
};
|
||||
|
||||
buildInputs =
|
||||
[ libX11 libXt libXft ncurses /* required to build the terminfo file */
|
||||
fontconfig freetype pkgconfig libXrender ]
|
||||
++ stdenv.lib.optional perlSupport perl
|
||||
++ stdenv.lib.optional gdkPixbufSupport gdk-pixbuf;
|
||||
|
||||
outputs = [ "out" "terminfo" ];
|
||||
|
||||
patches = [
|
||||
./rxvt-unicode-9.06-font-width.patch
|
||||
./rxvt-unicode-256-color-resources.patch
|
||||
]
|
||||
++ stdenv.lib.optional stdenv.isDarwin ./rxvt-unicode-makefile-phony.patch;
|
||||
|
||||
preConfigure =
|
||||
''
|
||||
mkdir -p $terminfo/share/terminfo
|
||||
configureFlags="--with-terminfo=$terminfo/share/terminfo --enable-256-color ${if perlSupport then "--enable-perl" else "--disable-perl"} ${if unicode3Support then "--enable-unicode3" else "--disable-unicode3"}";
|
||||
export TERMINFO=$terminfo/share/terminfo # without this the terminfo won't be compiled by tic, see man tic
|
||||
NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${freetype.dev}/include/freetype2"
|
||||
NIX_LDFLAGS="$NIX_LDFLAGS -lfontconfig -lXrender -lpthread "
|
||||
''
|
||||
# make urxvt find its perl file lib/perl5/site_perl is added to PERL5LIB automatically
|
||||
+ stdenv.lib.optionalString perlSupport ''
|
||||
mkdir -p $out/$(dirname ${perl.libPrefix})
|
||||
ln -s $out/lib/urxvt $out/${perl.libPrefix}
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
|
||||
cp -r ${desktopItem}/share/applications/ $out/share/
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
inherit description;
|
||||
homepage = http://software.schmorp.de/pkg/rxvt-unicode.html;
|
||||
downloadPage = "http://dist.schmorp.de/rxvt-unicode/Attic/";
|
||||
maintainers = with maintainers; [ rnhmjoj ];
|
||||
platforms = platforms.unix;
|
||||
license = licenses.gpl3;
|
||||
};
|
||||
})
|
|
@ -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;
|
||||
}
|
|
@ -381,7 +381,16 @@ mapAliases ({
|
|||
ruby_2_4_3 = throw "deprecated 2018-0213: use ruby_2_4 instead";
|
||||
ruby_2_5_0 = throw "deprecated 2018-0213: use ruby_2_5 instead";
|
||||
rubygems = throw "deprecated 2016-03-02: rubygems is now bundled with ruby";
|
||||
rxvt_unicode_with-plugins = rxvt_unicode-with-plugins; # added 2015-04-02
|
||||
rxvt_unicode_with-plugins = rxvt-unicode; # added 2020-02-02
|
||||
rxvt_unicode = rxvt-unicode-unwrapped; # added 2020-02-02
|
||||
urxvt_autocomplete_all_the_things = rxvt-unicode-plugins.autocomplete-all-the-things; # added 2020-02-02
|
||||
urxvt_perl = rxvt-unicode-plugins.perl; # added 2020-02-02
|
||||
urxvt_perls = rxvt-unicode-plugins.perls; # added 2020-02-02
|
||||
urxvt_tabbedex = rxvt-unicode-plugins.tabbedex; # added 2020-02-02
|
||||
urxvt_font_size = rxvt-unicode-plugins.font-size; # added 2020-02-02
|
||||
urxvt_theme_switch = rxvt-unicode-plugins.theme-switch; # added 2020-02-02
|
||||
urxvt_vtwheel = rxvt-unicode-plugins.vtwheel; # added 2020-02-02
|
||||
urxvt_bidi = rxvt-unicode-plugins.bidi; # added 2020-02-02
|
||||
s6Dns = s6-dns; # added 2018-07-23
|
||||
s6Networking = s6-networking; # added 2018-07-23
|
||||
s6LinuxUtils = s6-linux-utils; # added 2018-07-23
|
||||
|
|
|
@ -21216,35 +21216,11 @@ 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
|
||||
];
|
||||
};
|
||||
rxvt-unicode-unwrapped = callPackage ../applications/misc/rxvt-unicode { };
|
||||
|
||||
# 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-plugins = import ../applications/misc/rxvt-unicode-plugins { inherit callPackage; };
|
||||
|
||||
uade123 = callPackage ../applications/audio/uade123 {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue