Permit builtins.storePath
in pure evaluation mode #402
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
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
testing/flakey
ux
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#402
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?
This was discussed here: https://github.com/NixOS/nix/issues/5868
Essentially, it is not a purity break to do this, since you could in principle reconstitute the store path yourself (but there are reasons it may be impossible).
Eelco's argument against this is that it lets you make binary distributions of software that don't have build instructions and depend on the build-host state, but we already do that in nixpkgs! Just look at how the factorio derivation works: it uses a bogus FOD with a hash that happens to match someone's earlier
nix-store --add-fixed
. It doesn't seem like a very compelling argument since the FOD crimes are actually a lot easier and less surprising for someone to be doing and are permitted in pure mode (also the FOD crimes working is a "security issue" according to some, but shrug imo overblown and should be solved by a FOD verifier run in CI on newly added stuff or just periodically).The other case it, I guess, permits, is fetching something input-addressed that only exists on a substituter but you don't have the actual derivation for, but, maybe don't do that then?
The one other conceivable argument against this is that the nix evaluator in pure mode is currently a "sandbox" that, if someone is foolishly running it in a multi-tenant setup (don't do this!! surely there are bugs!) doesn't let you invent store paths of some other customer's source code with just a leak of its store path hash and then get its actual contents, if the only access you have is pure-mode nix evaluation but not shell access. We would have to loudly say we are doing it, but it seems like this would be nonetheless strictly an improvement in the status quo for us at least.
I do suspect that such a "leak" already exists if you just use a flake input by absolute path, so it doesn't really feel like a problem unless someone is mysteriously running such a foolish service without flake support, which should be approximately nobody.
There's very little reason not to do this IMO and a lot of upside.
@roberth argues that this should exist to be able to construct arbitrary string contexts from the Nix language, and we absolutely concur.
I am nonetheless posting here in case anyone else has opinions about it.
This issue was mentioned on Gerrit on the following CLs:
Like some people have discovered by now, most of what
builtins.storePath
can do also can be implemented usingbuiltins.appendContext
, which is already allowed in pure evaluation mode.I believe the following definition of
builtins.storePath
viabuiltins.appendContext
is functionally equivalent to the original, but I haven't verified in the the source code yet.