tweag / nix-hour

Questions for the weekly Nix Hour
MIT License
78 stars 3 forks source link

Debugging Nix code #30

Closed gaelreyrol closed 11 months ago

gaelreyrol commented 1 year ago

Hi,

I always struggled to debug my Nix code, luckily I manage most of the time to know where it comes from because I go tiny step after tiny step but sometimes it is completely cryptic to me and I have difficulties to use some of the builtins functions like trace or traceVerbose.

Would you accept to demonstrate your debug process or tips and tricks to spot what is wrong when you develop Nix code?

Thanks!

crazyminecuber commented 1 year ago

Would also be awesome if you could demonstrate other debugging methods like --debugger to get a repl for building a nixos system. Would also be awesome if you could show how to use breakpointHook and cntr to get an interactive shell where a build phase has failed.

I also think you should show how to interactively build a package defined in a flake used the new nix develop command and then manually calling all the build phases. It is documented how to do this the old way using nix-shell and non-flakes, but I have not been able to figure out how to do it with flakes.

infinisil commented 11 months ago

We decided to focus on this topic for this weeks Nix Hour, this Thursday at 18:00 CET! The topic is "Debugging Nix code", not going into derivation debugging for now. If you have any questions about this topic, either:

And if you just want to listen in, it's going to be streamed to YouTube here 🙂

gaelreyrol commented 11 months ago

Thanks! I won't be able to attend to this session but I will watch the replay!