nixbot icon indicating copy to clipboard operation
nixbot copied to clipboard

trafficstars
  • Nixbot

Nixbot is an IRC bot supporting Nix-related functionality. It's using a RabbitMQ broker maintained by @grahamc for sending messages via the ~{^_^}~ nick on freenode (and therefore can't run on its own currently).

** Functionality

*** Nix REPL

Nix can be evaluated by prefixing "> ":

#+BEGIN_SRC > (import {}).hello.name <{^_^}> "hello-2.10" #+END_SRC

You can also define variables:

#+BEGIN_SRC > pkgs = import {} <{^^}> pkgs defined > pkgs.hello.name <{^^}> "hello-2.10" #+END_SRC

The NixOS module makes sure that ~~ in ~NIX_PATH~ always points to the latest master nixpkgs version (updated once per minute).

*** Commands

You can define a key to string mapping via the ~,~ prefix:

#+BEGIN_SRC ,ask = Feel free to ask any questions about NixOS! <{^^}> ask defined ,ask <{^^}> Feel free to ask any questions about NixOS! ,ask paul <{^^}> paul: Feel free to ask any questions about NixOS! Ah, thanks! ,ask = <{^^}> Undefined ask, was defined as: Feel free to ask any questions about NixOS! , <{^_^}> Special commands: find locate tell - Commands sorted by use count, page 0 (use , to view page ): library tofu foo #+END_SRC

**** Special command: ,find

The ~find~ command allows you to find files in nixpkgs with a specific suffix. The bot will link to the latest github master version

#+BEGIN_SRC ,find setup.sh <{^^}> Found file: https://github.com/NixOS/nixpkgs/tree/014f1c9d/pkgs/stdenv/generic/setup.sh ,find hello/default.nix <{^^}> Found file: https://github.com/NixOS/nixpkgs/tree/014f1c9d/pkgs/applications/misc/hello/default.nix #+END_SRC

If there are multiple possible answers, it will choose the file with the most commits.

**** Special command: ,locate

The ~locate~ command uses [[https://github.com/bennofs/nix-index/][nix-index]] to find packages containing a certain file in their output. The ~bin~ subcommand only searches for binaries:

#+BEGIN_SRC ,locate bin gcc <{^^}> Found in packages: gcc, gcj, gccgo, gfortran, gcc_debug, ccacheWrapper, gcc-unwrapped, distccWrapper, distccMasquerade ,locate libass.so <{^^}> Found in packages: libass #+END_SRC

**** Special command: ,tell

~tell~ allows you to record a message for a user that currently is not in the channel. It will get relayed to them when they type a message in the channel:

#+BEGIN_SRC ,tell paul Remember to do the thing <{^^}> infinisil: I'll pass that on to paul Hello! <{^^}> paul: 2 hours, 52 minutes ago Remember to do the thing #+END_SRC

*** PR linking

When you link to a GitHub pull request (or post its number), the bot will post some info about it.

#+BEGIN_SRC #10000 <{^^}> https://github.com/NixOS/nixpkgs/pull/10000 (by ts468, 3 years ago, merged): nixos networking: add vswitch option https://github.com/NixOS/nixpkgs/issues/50902 <{^^}> #50902 (by endgame, 1 week ago, open): haskellPackages.postgresql-libpq fails to link on Darwin Infinisil/nixbot#4 <{^^}> https://github.com/Infinisil/nixbot/issues/4 (by Infinisil, 5 weeks ago, open): Better nix output parser nix#1000 <{^^}> https://github.com/NixOS/nix/pull/1000 (by shlevy, 2 years ago, closed): Allow throwing and catching arbitrary (string-coercible) values #+END_SRC