2020-01-09 21:28:42 +00:00
|
|
|
<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
|
2020-09-22 23:38:04 +01:00
|
|
|
<programlisting>
|
|
|
|
rxvt-unicode.override {
|
|
|
|
configure = { availablePlugins, ... }: {
|
2020-01-09 21:28:42 +00:00
|
|
|
plugins = with availablePlugins; [ perls resize-font vtwheel ];
|
2020-09-22 23:38:04 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
</programlisting>
|
2020-01-09 21:28:42 +00:00
|
|
|
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:
|
2020-09-22 23:38:04 +01:00
|
|
|
<programlisting>
|
|
|
|
rxvt-unicode.override {
|
|
|
|
configure = { availablePlugins, ... }: {
|
|
|
|
plugins = (builtins.attrValues availablePlugins) ++ [ custom-plugin ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</programlisting>
|
2020-01-09 21:28:42 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To get a list of all the plugins available, open the Nix REPL and run
|
2020-09-22 23:38:04 +01:00
|
|
|
<screen>
|
|
|
|
<prompt>$ </prompt>nix repl
|
2020-01-09 21:28:42 +00:00
|
|
|
:l <nixpkgs>
|
|
|
|
map (p: p.name) pkgs.rxvt-unicode.plugins
|
2020-09-22 23:38:04 +01:00
|
|
|
</screen>
|
2020-01-09 21:28:42 +00:00
|
|
|
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.
|
2020-07-31 06:06:53 +01:00
|
|
|
<literal>extraDeps</literal> can be used, for example, to provide
|
2020-01-09 21:28:42 +00:00
|
|
|
<literal>xsel</literal> (a clipboard manager) to the clipboard plugin,
|
|
|
|
without installing it globally:
|
2020-09-22 23:38:04 +01:00
|
|
|
<programlisting>
|
|
|
|
rxvt-unicode.override {
|
|
|
|
configure = { availablePlugins, ... }: {
|
|
|
|
pluginsDeps = [ xsel ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</programlisting>
|
2020-01-09 21:28:42 +00:00
|
|
|
|
|
|
|
<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:
|
2020-09-22 23:38:04 +01:00
|
|
|
<programlisting>
|
|
|
|
rxvt-unicode.override {
|
|
|
|
configure = { availablePlugins, ... }: {
|
|
|
|
perlDeps = with perlPackages; [ AnyEvent ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
</programlisting>
|
2020-01-09 21:28:42 +00:00
|
|
|
</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:
|
2020-09-22 23:38:04 +01:00
|
|
|
<programlisting>
|
|
|
|
passthru.perlPackages = [ "self" ];
|
2020-01-09 21:28:42 +00:00
|
|
|
</programlisting>
|
|
|
|
This will make the urxvt wrapper pick up the dependency and set up the perl
|
|
|
|
path accordingly.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</section>
|