Backport shebang support for Nix CLI #295
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
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#295
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?
Is your feature request related to a problem? Please describe.
Nix 2.19 introduced support for using the
nix
CLI as a shebang interpreter (PR, documentation). It's not a super important feature, but it is a nice-to-have, IMO.Describe the solution you'd like
As an example, I have a Fish script that has the following shebang:
This would use the Fish shell to run the script's contents.
Describe alternatives you've considered
nix-shell
: My system's NIX_PATH is kinda broken at the moment andnix-shell
doesn't work, but I have no reason to believe this wouldn't work otherwise.as I said over in the chat, I'm hesitant.
the goal is an admirable one, but the details look like kind of a nightmare and I'm not convinced this belongs in the nix executable at all. it seems like something that can and should be its own binary
looking at the upstream examples, they look exceptionally convoluted and dependent on fine details of lexing. every language design warning bell I have in me is going off. I strongly suspect that about two years from now, someone will think of a much simpler way to do this... at which time, it would be nice not to be locked into the complicated way forever for compatibility.
so, I lean strongly against this feature, but wanted to capture the reasoning for posterity. these will be easier decisions once we have more of the layering architecture in place; the looser things are coupled, the easier it is to leave our mistakes in the past.
um - I think this was clear in chat but in case it's not, I'm still very grateful that you raised this for discussion and filed an issue about it
also just so you know, the
nix-shell
shebang is spectacularly broken: https://github.com/NixOS/nix/pull/5088(in addition, @puck found yet another bug in it, where if you use two spaces with
#!nix-shell -p
it causes a wicked parse error)but it's unclear if we could fix the
nix-shell
shebang without regressing other things.but also, there is nothing stopping someone writing a better one as an external tool and exploring that design space better (especially in re: how should this work for non-flakes equally) without committing lix to maintaining another questionable parser (we recall that the PR 8327 parser has some questionable syntax decisions that seem like footguns).
Fair nuff. Unsure what the issue workflow tends to look like around these parts, so I'll leave it to yall to close or mark wontfix or stuff like that
Marking this wontfix, but per discussion on matrix, we are encouraging someone (srxl might have been nerd sniped) to prototype a better one in Rust with the intent that it might be included in Lix at some point, or it might just be a good piece of separate software!