Searchable Reference Materials

Finding any info on nix feels really hard. Is there just a giant reference somewhere were I can use to find out about functions and stuff the manual feels lacking for when you have real issues

2 Likes

It is rough, especially when you’re trying to find your sea legs.

A little more detail may draw out better answers…

  • Which manual(s) are you already looking at?
  • When you say you’d like a giant searchable reference, do you mean a single large document to find within, or something more like a search engine?
  • Can you give an example or two of something you’re looking for where you found the manual lacking?

Not the original poster, but also a new user to Nix and finding it incredibly difficult to find anything. In my specific case, how do I go about finding function definitions with descriptions of parameters and return values for the functions in pkgs? For example, pkgs.mkShell or more specific ones like pkgs.buildGoModule. There’s also a whole pkgs.lib subsection which I see a lot of random stuff coming out of.

To use other tools as an example - Ansible has copious amounts of documentation for each function, what parameters it takes, what it returns, and often usage examples. I also recently learned Terraform which has extensive documentation on the HCL language as well as great API documentation for basically every provider. I can’t seem to find anything similar for Nix which is really concerning to me.

2 Likes

Mainly the nix & nixos and some time nix pills if i geting really lost.
Im just looking for something i can grep/Ctrl+F and get helpfull information
well I often get help in the unoffical discord, I had some issues with some games conflicting after wraping them, and any way I ended up geting help but they metioned setPriority but i have not been able to find anything about this flag??option??argument?? and what I has to Deviations/Pkgs.

1 Like

https://nixos.org/manual/nixpkgs/unstable/#sec-pkgs-mkShell

https://nixos.org/manual/nixpkgs/unstable/#ssec-language-go

https://nixos.org/manual/nixpkgs/unstable/#sec-functions-library

Both of those tools are developed by commercial entities so it is not surprising that they would have better documentation.

https://nixos.org/manual/nixpkgs/unstable/#var-meta-priority

If you are looking for a more detailed documentation, your best option is the source code. So I suggest cloning the Nixpkgs repository locally and use a grep-like tool to search on it. Like

❯ rg "setPrio = "
lib/meta.nix
50:  setPrio = priority: addMetaAttrs { inherit priority; };

❯ rg "addMetaAttrs = "
lib/meta.nix
15:  addMetaAttrs = newAttrs: drv:

❯ sed -n -e 15,25p lib/meta.nix
  addMetaAttrs = newAttrs: drv:
    drv // { meta = (drv.meta or {}) // newAttrs; };
  ...

I’m not trying to unfairly compare Nix to these products - I understand they are both commercially supported. I was more just trying to use a well-known example for what I was looking for. It appears that wiki is the authoritative source for function descriptions?

A more comparable example would probably be modern languages self-documenting capabilities; take for example a recent Rust crate I wrote. I was hoping Nix might have something similar where I can browse the code in a documented format so I can better understand what exists in the standard library and how it’s used.

Here is another example for Consul written in Go using the built-in documentation feature. This provides what the OP is looking for I think - a way to ctrl + f and find your way around the code in a documented manner.

2 Likes

I thank you, source code is the best documentation, but navigation becomes problem real fast. I just find nav-ing around really difficult.