Ban resolving registry indirect flake inputs #170
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
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#170
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?
Currently you can specify a flake without
inputs.*.url
and it will use the flake registry. This is utterly broken behaviour as it means that updating a flake depends on host specific state such as flake registry pins, which may be completely broken if such pins are to a filesystem path such as is the default on NixOS unstable.Let's just ban nix flake update on such inputs.
Just to clarify: is this issue to ban indirect flake inputs entirely or just banning updating those inputs? The reason why is that the title sounds more like the former whereas the description sounds more like the latter.
I would like to ban updating them or resolving them. If they're already locked and we block that, that is a much bigger breakage to ban them than to just ban updating them.
Ban registry indirect flake inputsto Ban resolving registry indirect flake inputsDo you mean that we're grandfathering existing
flake.nix
files that use indirect flake inputs if they've already been locked inflake.lock
, but we refuse to lock new indirect flake inputs going forward?Yes. It seems like the way that ratchets correctness without breaking users who aren't actively doing something to the code.
hmmm this should go in the stability policy notes, this is a general view
edit: in fact, we could even print what it resolved to, to put in the flake file and then refuse to proceed.
Do we intend to support the flake registry at all? The reason I'm asking is that the arguments you're making against unspecified flake inputs seem to equally apply as reasons to drop the flake registry entirely. Like, even if the user explicitly added an input of the form:
… that would still be victim to the problem you describe that "updating a flake depends on host specific state such as flake registry pins".
The flake registry is still really handy for command-line usage so I can't imagine wanting to drop it entirely. But command-line usage doesn't require actually locking flakes, which is the thing we want to avoid doing on the registry
Oh yes I would like to ban that too. Any usages of the flake registry in flake.nix files should be banned with prejudice.
The only place the registry should be a going concern is in direct CLI usages and even those I honestly just want to fix the thing in place by locking the flake registry in time and including it with the distribution as a default value of a configuration option. I'll file an issue for that.
@qyriad: Command-line usage does conceptually lock a flake even if it doesn't create a
flake.lock
file per se. For example:That will remain locked until the
tarball-ttl
expiresYes in the codebase it is also technically a flake lock, even absent any notion of
tarball-ttl
its technically the same mechanismI think it makes it harder to use flakes for personal devshells that are not intended for sharing with other machines. If every flake will be required to separately pin nixpkgs, I’d end up with a lot more copies of stuff in my store, since I’d probably forget to manually update half the flakes.
It could be mitigated by making it easy to update the flake to point to the same version as the system nixpkgs though, maybe via some command that can be put into
.envrc
. (I guess it could already be done by using jq on/etc/nix/registry.json
, but that’s not really ergonomic).this demonstrates a critical design flaw of flakes as a whole: there is no such thing as an ephemeral environment outside of the (severly lacking)
nix shell
andnix run
commands. you are correct that using a flake purely for dev shells would suffer if the registry were outlawed for inputs. the takeaway from that shouldn't be to not disallow registry use though, but rather to add restore functionality ofshell.nix
that was needlessly thrown away. for example, why shouldnix shell
without arguments not readshell.nix
and auto-call it with entries of the flake registry?That’s fair, it would be a valid replacement for this use case. In general, I think shells can have both updatable and non-updatable inputs (for example, I want a specific version of some utility that’s not in nixpkgs, but I’m fine with whatever nixpkgs I currently have). Using old-style
shell.nix
for all personal devshells makes it a bit harder to use updatable inputs (you’d need to either use something niv-like or manually update versions), but given that it’d probably run in impure mode, I don’t think it’s that bad: it’d be enough to just update version tag, without painstakingly recalculating hashes.I am potentially interested in hacking on this part, is there an issue?
don't think there is one, but we also don't have a full design (yet); what we said earlier was more to illuminate the problem space than suggest actual semantics. we could conceivably just take an implementation and mark it experimental until we're satisfied though?
I asked about an issue because there’re some design considerations I’d like to discuss (I’ll share them here, but feel free to point me to a more suitable venue).
old-style
shell.nix
doesn’t currently accept any arguments, it just returns a derivation (you kinda can pass arguments via--arg
, but they require default values). that means that adding auto-filling for arguments with no default values is not a breaking change, which is nice. there’re some options as to which arguments get passed though:flakes from the registry (so basically only
nixpkgs
for most shells). requires the shell toimport nixpkgs
manually every time, but allows e.g. overlays, so is the most flexible.packages via
callPackage
, asnix-build
does. very concise and pleasant for simple shells, but less flexible and doesn’t provide a clean way to access other flakes from the registry.somehow both? placing them into the same namespace feels bad though, name conflicts are bound to happen. something like
could potentially solve this problem, but that’s very much not a syntax today.
I’m leaning towards the first option, as it’s flexible, has simple semantics and doesn’t require new syntax, and I’ll try to write a basic implementation to see how that works. I’d be interested to hear another opinions on the issue though.
--inputs-from [flake-url]
(which has an official description of "Use the inputs of the specified flake as registry entries.") seems to fall under this want for deprecation.