Documentation should point out that __impure and __noChroot do not affect builtins in the way that --impure does #390
Labels
No labels
Area/build-packaging
Area/evaluator
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#390
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
There are several related concepts of pure evaluation, sandboxing, etc. Flakes introduce a concept of pure evaluation which restricts the behavior of certain builtins, including builtins.readFile, and removes others. The nix "sandboxing" option introduces a different behavior, which among other things does builds in a chroot when it's true, and also prevents network access.
The --impure flag, given at the command line, disables both of these behaviors. By design, it must be given every time, it cannot be set system-wide. This is probably a good thing.
There are at least two special-purpose attributes, one of them experimental, which override some of this behavior on a per-derivation basis. __impure allows network access, regardless of the setting of the sandboxing option. __noChroot causes the derivation to be built without a chroot, but only when the sandboxing option is set to the non-default value "relaxed". Neither of these attributes does anything to allow unrestricted use of builtins, and indeed due to lazy evaluation semantics it's not clear how that could happen on a per-derivation basis. This is unfortunate for use-cases that really need to not only access the filesystem but use that information in nix evaluation, but the restrictions make sense once properly understood. What doesn't make sense is the documentation.
Proposal
I realize that __impure is an experimental feature (the others are mainline), but this complex tangle of behaviors is quite difficult to make sense of. I think it would be useful to have some sort of "escape hatches" section of the manual which describes it all in one place.
Checklist
--impure affects only the evaluator. It has no effect on the sandbox or the builder whatsoever.
That doesn't seem consistent with the tests I did last night, but it's possible that I wasn't testing in a way that drew out the actual behavior. At any rate I think there's more than enough potential for confusion that this needs documentation, heh.
I have confirmed in the code.
b8cb7abcf0/src/libcmd/common-eval-args.cc (L113-L120)
Huh. Thank you. I think I understand how my test case wound up not hitting that... I had a lot of trouble at first separating out the builtin semantics from the chroot, since they both restrict the filesystem.