Set custom argv0 for lix custom sub-commands #1225
Labels
No labels
Affects/CppNix
Affects/Nightly
Affects/Only nightly
Affects/Stable
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/lix ci
Area/nix-eval-jobs
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/repl/debugger
Area/store
awaiting
author
awaiting
contributors
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
diagnostics
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
Feature/S3
Importance
High
Importance
Low
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
Release Blocking
Non-urgent
Release Blocking
Urgent
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
Urgency
High
Urgency
Low
ux
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lix-project/lix#1225
Loading…
Add table
Add a link
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.
The
lix-custom-sub-commandsexperimental feature is very useful, but its actual use is somewhat limited by the fact that the executed program has no way of knowing if it's being launched as a regular program or as a lix sub-command. For example, I'd have like to allownix-debugto have a nix3-style interface when called aslix debug, but there's no way of knowing if a user manually called it aslix-debug(which would have a nix2 interface) orlix debug(with a nix3 interface).Describe the solution you'd like
Set sub-command's
argv[0]tolix $cmd(e.g.lix debug).Describe alternatives you've considered
None.
Additional context
This is a very minimal change, but I thought I'd get validation about it beforehand :)
the nix2 cli is completely dead end in every possible way. new commands should be encouraged to not repeat the same mistakes and provide a uniform interface for all things instead? do you have any command in mind for which it makes any sense for it to change its interface depending on how it was called?
the
nix-debugexample i linked is supposed to be a small, drop-in wrapper aroundnix-build, and i'd like to also make it possible to use it as a wrapper around the nix3nix build, without having to generate two separate executables. currently, i instead have to translate any nix3 build invocation to nix2-style, and if i switchednix-debugto always usenix buildunder-the-hood, i would then have to always translate nix2 invocations to nix3, which is frustrating for a supposed "drop-in replacement".in addition, aliasing the same program but with different name/argv0 is a pretty common practice, especially for wrappers and small utilities, which i expect quite a few lix sub-commands might be.