https://github.com/infinisil/nixbot
https://github.com/infinisil/nixbot
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/infinisil/nixbot
- Owner: infinisil
- License: mit
- Created: 2017-12-28T14:27:15.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-18T11:24:05.000Z (over 3 years ago)
- Last Synced: 2025-03-10T04:49:27.105Z (4 months ago)
- Language: Haskell
- Size: 759 KB
- Stars: 25
- Watchers: 4
- Forks: 4
- Open Issues: 5
-
Metadata Files:
- Readme: Readme.org
- License: LICENSE
Awesome Lists containing this project
README
* 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_SRCYou can also define variables:
#+BEGIN_SRC
> pkgs = import {}
<{^_^}> pkgs defined
> pkgs.hello.name
<{^_^}> "hello-2.10"
#+END_SRCThe 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_SRCIf 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