-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Backport breakpointHook [18.09] #49099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
(cherry picked from commit 84e915a)
Usuage: Add breakpointHook to your `buildInputs` like this: stdenv.mkDerivation rec { # ... buildInputs = [ breakpointHook ]; }); When the build fails as show in this example: pkgs.hello.overrideAttrs (old: { buildInputs = [ breakpointHook ]; postPatch = '' false ''; }); It will halt execution printing the following message: build failed in patchPhase with exit code 1 To attach to this build run the following command as root: cntr attach -t command cntr-/nix/store/ynyb4n82x2r7sldd58pbb405jdqh5f00-hello-2.10 Installing cntr and running the command will provide shell access to the build sandbox of failed build: sudo cntr attach -t command cntr-/nix/store/ynyb4n82x2r7sldd58pbb405jdqh5f00-hello-2.10 WARNING: bad ownership on /nix/var/nix/profiles/per-user/root, should be 1000 [nixbld@localhost:/var/lib/cntr]$ At /var/lib/cntr the sandbox filesystem is mounted. All commands and files of the system are still accessible within the shell. To execute commands from the sandbox use the `cntr exec` subcommand. (cherry picked from commit f10b935)
(cherry picked from commit 325a569)
Success on aarch64-linux (full log) Attempted: breakpointHook The following builds were skipped because they don't evaluate on aarch64-linux: cntr Partial log (click to expand)
|
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: breakpointHook, cntr Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: breakpointHook, cntr Partial log (click to expand)
|
doc/stdenv.xml
Outdated
This hook will make a build pause instead of stopping | ||
when a failure happen. It prevents nix to cleanup the build | ||
environment immediatly and allows the user to attach | ||
to a build environemnt using the <varname>cntr</varname> command. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<command>
is probably better suited for this
(cherry picked from commit 7f80fb2)
Success on aarch64-linux (full log) Attempted: breakpointHook The following builds were skipped because they don't evaluate on aarch64-linux: cntr Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: breakpointHook, cntr Partial log (click to expand)
|
No attempt on x86_64-darwin (full log) The following builds were skipped because they don't evaluate on x86_64-darwin: breakpointHook, cntr Partial log (click to expand)
|
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)