How can I find the definition of a package

Hi there, regularly I would like to jump to the precise nix expression which defines a package.

I learned that on the nix repl just looking at a function shows its file location. So I was thinking, one way to find the place where a package is defined is to get its underlying function which was called with callPackage.

is there a way to extract the original function from the called package?

For most cases you can use nix edit on the shell or :e on the REPL to open an expression directly in the editor.

This doesn’t work for some more involved things though.

worked immediately for me. Thank you so much!

1 Like