Finding things in nixpkgs and NixOS source (nixcon2023)

Published: Sept. 9, 2023, 8:15 a.m.

b"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.\\n\\nAfter this talk, getting around in nixpkgs should be familiar and quick.\\n\\nThere 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.\\n\\nI 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.\\nabout this event: https://talks.nixcon.org/nixcon-2023/talk/BAVND7/"