[Nix-dev] Tool: Better code search on NixOS/*

Fabian Schmitthenner nix-dev at schmitthenner.eu
Fri Mar 4 18:03:57 CET 2016


On 03/04/2016 07:25 AM, Vladimír Čunát wrote:
> On 03/04/2016 04:00 AM, Graham Christensen wrote:
>> I frequently try to find where a particular package is declared, or 
>> patches, or other slightly more complicated search queries than GitHub 
>> will support.
great, especially when surfing on the web this avoids friction of doing
the grep thingy and switching back to firefox.
> A couple of ways you may not know, and it might be good to post them
> publicly:
>
> 1.
> $ cd my/nixpkgs && nix-repl .
> nix-repl> clang.meta.position
> "/path/to/my/nixpkgs/pkgs/build-support/cc-wrapper/default.nix:274"
That's great. I also recently thought about displaying positions of
functions, so locally I currently have

$  nix-repl nixpkgs
nix-repl> lib.attrByPath
«lambda defined at /home/fabian/nixpkgs/lib/attrsets.nix:18:16»

So, there will be a pull request soon, that adds this feature (just not
sure if we want to display it when just writing the functions or maybe
only with a :doc or something). Still greater would be to display the
docstring of the function, but therefore we need* to change the parser
to include (these) comments. We might also want to show the contents of
the function (the data is also already there).

Fabian

[*] Okay, we could probably also look at the file at the position and
look for the comment before this position
>
> 2.
> We have ctags wrapped with simple regexp that indexes simple 'foo ='
> bindings. That has the advantage of integrating smoothly with many editors.
>
> Happy searching!
> --Vladimir
>
>
>
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160304/2542ef94/attachment.html 


More information about the nix-dev mailing list