Skip to content

infinisil/nixbot

Repository files navigation

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 “> “:

<infinisil> > (import <nixpkgs> {}).hello.name
    <{^_^}> "hello-2.10"

You can also define variables:

<infinisil> > pkgs = import <nixpkgs> {}
    <{^_^}> pkgs defined
<infinisil> > pkgs.hello.name
    <{^_^}> "hello-2.10"

The NixOS module makes sure that <nixpkgs> 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:

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

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

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

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

Special command: ,locate

The locate command uses nix-index to find packages containing a certain file in their output. The bin subcommand only searches for binaries:

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

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:

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

PR linking

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

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •