Skip to content

buildStackProject: Set __noChroot to make it fail without sandbox#73362

Merged
cdepillabout merged 2 commits intoNixOS:masterfrom
infinisil:buildStackProjectChroot
Nov 14, 2019
Merged

buildStackProject: Set __noChroot to make it fail without sandbox#73362
cdepillabout merged 2 commits intoNixOS:masterfrom
infinisil:buildStackProjectChroot

Conversation

@infinisil
Copy link
Member

Motivation for this change

Currently buildStackProject doesn't have any indication that it needs the sandbox to be disabled, leading to a hard-to-decipher error, see #32005

With this change, doing a buildStackProject will result in

error: derivation '/nix/store/nk4wms3hk4mp9lc86k30vc8w44fcq0rj-foo.drv' has
  '__noChroot' set, but that's not allowed when 'sandbox' is 'true'

when attempting to build it without --option sandbox false

Fixes #32005

Things done
  • Made sure this error happens without disabling the sandbox

@ofborg ofborg bot added 6.topic: haskell General-purpose, statically typed, purely functional programming language 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Nov 13, 2019
@cdepillabout
Copy link
Member

@infinisil Thanks for this change. I was actually thinking of doing this myself.

I think this is okay as-is, if you'd like to go ahead and merge it.

However, if possible, I think it would be nice to add a little more documentation. For example, either linking to the nix manual where it talks about __noChroot, or alternatively just adding a small example of running nix-build with sandbox set to relaxed.

As a new user, at one point I came across __noChroot and had no idea what it meant or where I could find more information about it.

Building such a derivation will result in

  error: derivation '/nix/store/nk4wms3hk4mp9lc86k30vc8w44fcq0rj-foo.drv' has '__noChroot' set, but that's not allowed when 'sandbox' is 'true'

when attempting to build it without --option sandbox false
@infinisil infinisil force-pushed the buildStackProjectChroot branch from 49b2922 to 27e7b9a Compare November 14, 2019 00:32
@infinisil
Copy link
Member Author

Added a bit more comment and docs

@ofborg ofborg bot added the 8.has: documentation This PR adds or changes documentation label Nov 14, 2019
@cdepillabout
Copy link
Member

Thanks! Looks really good!

@cdepillabout cdepillabout merged commit d0c73e8 into NixOS:master Nov 14, 2019
@infinisil infinisil deleted the buildStackProjectChroot branch November 14, 2019 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buildStackProject: fails downloading resolver

2 participants