Skip to content

Add a command line option to interactively debug failed builds #16181

Description

@zackw

Is your feature request related to a problem?

If a build fails, it is very useful to be able to enter the build environment and troubleshoot it interactively. As far as I can tell, the only way to do this right now is by adding nixpkgs' special package breakpointHook to the nativeBuildInputs of a troublesome derivation. Doing this may be quite difficult, especially for inexperienced Nixpkgs developers, and it also perturbs the build environment in a way that could potentially mask the problem (since there are additional packages visible to the build).

The nix3 build subcommand has an option --debugger which allows interactive debugging of a failed Nix expression evaluation, but this doesn't help with a failed build, and it's not, as far as I can tell, available to traditional nix commands.

Proposed solution

  1. Add the --debugger option to all the traditional nix commands.
  2. Expand the functionality of --debugger to include an effect akin to the effect of adding breakpointHook to nativeBuildInputs, but, crucially, without requiring modification of the derivation or perturbing the build environment.

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureFeature request or proposal

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions