[WIP] Add a compatibility shim for non-flake nix #3366
Closed
+59
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This compatibility shim uses an extremely naïve parsing of
flake.lock
to get the dependencies.
It then uses a naïve implementation of flakes to produce the build.
Intent
I am sharing the current state of the shim, half-expecting that there are things to fix.
With a flakes-free nix, this handles:
nix build
ornix-build
to build.nix-shell
.It is my opinion that this, or another implementation of such a shim, should be present in the flakes branch, and then in the master branch, up until a full release cycle of nix has had flakes enabled by default.
Not doing so makes for a confusing experience for getting started in looking at the flakes branch, at first. Then, allowing this for one full release might not be as useful at that point, but will allow laggards to at least be able to use this repository with
nix v"flakes-1"
.I would recommend, once flakes get into master, assuming there is such a shim, that the warning documents that this is going to be dropped in
nix v"next release"
, also linking to a proper location for upgrades instructions.Implementation details
This implementation is probably wrong in some ways. It does work for nix, but I wouldn't assume it works for all flakes. Surely, it would be helpful to include such a shim in all "core" flakes around the NixOS organization, if it can be fixed to be good enough for all of our flakes.
I am open to critique, rework, everything to make this better for inclusion in nix. Tell me what I did wrong, I'll be glad to get it sorted out.