Google Hangouts with Irssi on Nixos

31 May 2018

nixos , irssi

As I wanted to have access to Google Hangouts chats with Irssi on NixOS, here is a write-up of how I got it working.

The protagonists

After a quick research using my favorite search engine DuckDuckGo, it turns out that we will need to add two piece of software to Irssi.

Add them to the system

We are pretty lucky as packages for BitlBee and purple-hangout are available on NixOS.

However, purple is not a plugin installed by default in the bitlbee package: we need to declare that we want it enabled.

Having a look at the declaration of bitlbee, we can find out the name of the relevant build option.

Let’s edit /etc/nixos/configuration.nix:

environment.systemPackages = with pkgs; [
  [...]
  bitlbee
  purple-hangouts
  [...]
];

nixpkgs.config.bitlbee.enableLibPurple = true;

services.bitlbee = {
  enable = true;
  libpurple_plugins = [ pkgs.purple-hangout ];
};

You can see how this fit my whole configuration on my GitHub repo.

Then rebuild the system:

sudo nixos-rebuild switch

Try it out

See how it goes: start irssi, then type the following commands:

<@pamplemousse> /connect localhost
<@pamplemousse> /join &bitlbee

At this point, I need to create an account to identify myself to the BitlBee server.

<@pamplemousse> register StrongPasswordGeneratedWithKeepassXC

And verify our the plugin to communicate with Google Hangouts is present:

<@pamplemousse> plugins
[...]
<@root> Enabled Protocols: aim, bonjour, gg, hangouts, icq, identica, irc, jabber, novell, oscar, simple, twitter, zephysr

All good!

Setting up BitlBee to access your Google Hangouts account

<@pamplemousse> account add hangouts MyAddress@Email.Com
<@pamplemousse> acc hangouts on

The next step is one of the most unreliable thing I have ever done to configure an account.

In fact, the previous command created another Irssi window to interact with the lib (that is, a private conversation with purple_request_0).

Follow the instruction that appeared there, and reply the oauth code that you obtain in the conversation (took me 30 minutes to figure this out).

Once that’s done, you should see all your contacts appearing in the &bitlbee window.

Try it out

We can now start 1-on-1 conversations, for example with JohnDoe:

<@pamplemousse> /msg JohnDoe hello

And even join group chats (that exists):

<@pamplemousse> help chat list
<@pamplemousse> chat list hangouts
<@pamplemousse> chat add hangouts !1 #chatname

So later on, we can use the shortcut #chatname:

<@pamplemousse> /j #chatname

That’s it! We now can chat on Google Hangouts from Irssi!