NixCon 2023

Finding things in nixpkgs and NixOS source
2023-09-09 , Lecture hall (Room 122)

Even with recent improvements in documentation, sometimes the most expedient way to understand nixpkgs and NixOS is to read the source code. However, that's not trivial: there are now 2.9 million lines of Nix source in nixpkgs. This talk shows several methods of finding the sources behind things in nixpkgs and NixOS from using ctags to various lesser-known tricks in the repl.

After this talk, getting around in nixpkgs should be familiar and quick.


There are a lot of tools and methods for getting documentation and finding things in Nix but they are often not well publicized and form peoples' private workflows. Substantial progress has been made on this, for instance, with nixd, but there are other methods that still have their place when more advanced tools don't have perfect code context. This talk introduces a novel NixOS-modules ctags implementation allowing finding option definitions nearly instantly. It also presents how to navigate nixpkgs using nix-doc for ctags and to get function documentation in the Nix repl, how to fall back on unsafeGetAttrPos, and how to use the Nix debugger.

I will briefly dive into the internals of NixOS to show the introspection capabilities it provides for where settings come from, and how to load a NixOS configuration into the repl for inspection in the first place.


Do you allow your talk to be recorded?: yes What level of experience in Nix is the talk addressed to?:

Mid-level

Jade is a Computer Engineering student at the University of British Columbia in Vancouver, Canada. Their usual areas of focus are tooling, compilers, and operating systems.

Jade uses Nix and NixOS extensively, particularly for development environments and Haskell.

Their Web site can be found at https://jade.fyi