Nix (language): Difference between revisions

imported>Profpatsch
add https://github.com/NixOS/
imported>Roberth
Line 392: Line 392:


If you don’t have a <code>nixpkgs</code> checkout at hand, you can use the repo search at [https://search.nix.gsc.io/ search.nix.gsc.io]. This even searches in all repositories of the [https://github.com/NixOS/ NixOS Github organization].
If you don’t have a <code>nixpkgs</code> checkout at hand, you can use the repo search at [https://search.nix.gsc.io/ search.nix.gsc.io]. This even searches in all repositories of the [https://github.com/NixOS/ NixOS Github organization].
Another trick that only works for functions, is evaluating the function on the <code>nix repl</code>:
<pre>
nix-repl> pkgs.lib.strings.makeBinPath
«lambda @ /home/user/nixpkgs/lib/strings.nix:94:42»
</pre>
This doesn't work for non-functions or builtin functions, which show <code>«primop»</code>. It will always find the actual lambda, not an attribute that reexports a partial application, for example.


=== Convert a string to an (<code>import</code>-able) path ===
=== Convert a string to an (<code>import</code>-able) path ===