Weechat: Difference between revisions
imported>Thornycrackers No edit summary |
imported>Oxzi No edit summary |
||
Line 1: | Line 1: | ||
''WeeChat'' is an extensible chat client with a command line interface. | ''WeeChat'' is an extensible chat client with a command line interface. | ||
== | == Scripts == | ||
WeeChat can be extended with | WeeChat can be extended with scripts. Those can be written in a variety of scripting languages. As these scripts may depend on external libraries, we need to take care that those are found by WeeChat. This can either be done by adding already packaged scripts or by extending WeeChat's extraBuildInputs. | ||
=== Packaged WeeChat Scripts === | |||
There are multiple prepackaged <code>weechatScripts</code> in the nixpkgs. Those are Nix packages for a WeeChat script with the script's extra dependencies. The easiest way is to create an [[Overlays | overlay]]. | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
self: super: | |||
{ | { | ||
weechat = super.weechat.override { | |||
configure = { availablePlugins, ... }: { | |||
scripts = with super.weechatScripts; [ | |||
weechat-otr | |||
wee-slack | |||
]; | |||
}; | |||
}; | }; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== | === WeeChat extraBuildInputs === | ||
For example the [https://weechat.org/scripts/source/jabber.py.html/ Jabber script] depends on the <code>xmpppy</code> python library, which is provided in a separate nix package. To make WeeChat find the library, we can override the <code>weechat</code> nix package and add the dependency as an extra build input, e.g. by changing the <code>~/.nixpkgs/config.nix</code> as follows: | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | { | ||
packageOverrides = pkgs: rec { | |||
weechat = pkgs.weechat.override { extraBuildInputs = [ pkgs.xmpppy ]; }; | |||
}; | }; | ||
} | } | ||
</syntaxhighlight> | |||
=== Problem loading multiline.pl === | |||
The script <b>multiline.pl</b> depends on the Pod::Select module. However, since perl version v5.31.1 Pod::Select has been removed. You can either install PodParser or use nix-shell to wrap weechat so it can find it: | |||
<syntaxhighlight lang="shell"> | |||
nix-shell -p perl -p perl532Packages.PodParser --run weechat | |||
</syntaxhighlight> | </syntaxhighlight> | ||
This script was also packaged as <code>weechatScripts.multiline</code> and is currently available in the [https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/networking/irc/weechat/scripts/multiline/default.nix unstable release]. | |||
== Glowing Bear, nginx, TLS, and Oauth2 Proxy == | == Glowing Bear, nginx, TLS, and Oauth2 Proxy == | ||
One can set up Glowing Bear as a web client to Weechat. However, its best to proxy inbound connections from the internet through a more robust service with TLS enabled. Lastly, it's convenient to reuse an auth provider to provide access to internal applications. | One can set up Glowing Bear as a web client to Weechat. However, its best to proxy inbound connections from the internet through a more robust service with TLS enabled. Lastly, it's convenient to reuse an auth provider to provide access to internal applications. | ||
Line 151: | Line 88: | ||
}; | }; | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 13:28, 23 February 2021
WeeChat is an extensible chat client with a command line interface.
Scripts
WeeChat can be extended with scripts. Those can be written in a variety of scripting languages. As these scripts may depend on external libraries, we need to take care that those are found by WeeChat. This can either be done by adding already packaged scripts or by extending WeeChat's extraBuildInputs.
Packaged WeeChat Scripts
There are multiple prepackaged weechatScripts
in the nixpkgs. Those are Nix packages for a WeeChat script with the script's extra dependencies. The easiest way is to create an overlay.
self: super:
{
weechat = super.weechat.override {
configure = { availablePlugins, ... }: {
scripts = with super.weechatScripts; [
weechat-otr
wee-slack
];
};
};
}
WeeChat extraBuildInputs
For example the Jabber script depends on the xmpppy
python library, which is provided in a separate nix package. To make WeeChat find the library, we can override the weechat
nix package and add the dependency as an extra build input, e.g. by changing the ~/.nixpkgs/config.nix
as follows:
{
packageOverrides = pkgs: rec {
weechat = pkgs.weechat.override { extraBuildInputs = [ pkgs.xmpppy ]; };
};
}
Problem loading multiline.pl
The script multiline.pl depends on the Pod::Select module. However, since perl version v5.31.1 Pod::Select has been removed. You can either install PodParser or use nix-shell to wrap weechat so it can find it:
nix-shell -p perl -p perl532Packages.PodParser --run weechat
This script was also packaged as weechatScripts.multiline
and is currently available in the unstable release.
Glowing Bear, nginx, TLS, and Oauth2 Proxy
One can set up Glowing Bear as a web client to Weechat. However, its best to proxy inbound connections from the internet through a more robust service with TLS enabled. Lastly, it's convenient to reuse an auth provider to provide access to internal applications.
This configuration snippet can illustrate how to configure it:
{ config, pkgs, ... }:
{
services.weechat.enable = true;
# Go read the terms at https://letsencrypt.org/repository/
security.acme.acceptTerms = false;
security.acme.email = "";
services.nginx = {
enable = true;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
# You'd think this is a good idea, but Safari doesn't support 1.3 on websockets yet from my testing in 2020. If one is only using Chrome, consider it.
# sslProtocols = "TLSv1.3";
virtualHosts = {
"irc.your.fqdn.goes.here" = {
forceSSL = true;
enableACME = true;
locations."^~ /weechat" = {
proxyPass = "http://127.0.0.1:9000";
proxyWebsockets = true;
};
locations."/" = {
root = pkgs.glowing-bear;
};
};
};
services.oauth2.proxy = {
enable = true;
email.addresses = ''
# your email goes here for authorization
'';
nginx.virtualhosts = [
"irc.your.fqdn.goes.here"
];
clientID = "";
keyFile = "";
};
}