nix develop --show-phases #981
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
bug
Context
contributors
Context
drive-by
Context
maintainers
Context
RFD
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Language/Bash
Language/C++
Language/NixLang
Language/Python
Language/Rust
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
Topic/Large Scale Installations
ux
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#981
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.
When trying to debug a nix build, it's possible to start the nix shell and if you know where to look you can figure out all the phases this build has. Then you can start them in the right order by invoking the
*Phase
shell functions / scripts.This works, but is quite magic.
Describe the solution you'd like
We already have
nix develop --unpack
and friends, as well as the more genericnix develop --phase $SOME_PHASE
. But we do not have a way to get the list of phases in the right order.This is what I'm proposing: a flag that just prints those in the order that they need to be executed to make the build happen. Then you can manually run and re-run those phases as often as you need to debug them.
Describe alternatives you've considered
nix develop --phase $PHASE
has the advantage that it is easy to run, even while you are working on (and changing) the nixpkgs package.What do you think?
I think: this is a layering violation. I am not sure how responsibility should be passed off to nixpkgs, but we should be very careful about how we implement this so that we are not tangling ourselves in nixpkgs in
nix develop
any more than necessary. I am in general opposed in principle to implementing this in Lix as it is likely to cause pain to both us and nixpkgs due to the layering violation surface area.Maybe a
printPhases
function should exist in stdenv? Should stdenv have a way of jamming some debugging shell hooks intonix develop
shells?N.B. I know that
nix develop
, even more thannix-shell
(somehow?) is the layering violation command. Adding more of those adds more fragility and difficulty for nixpkgs to do its job.Lix actually has no idea what phases there are:
script += fmt("runHook %1%Phase\n", *phase);
All the existing phase flags like
--unpack
are hardcoded, and won't even work in cases where a setup hook adds a phase that semantically performs that function but is under a different name (did you knowpytest
doesn't run incheckPhase
orinstallCheckPhase
?). Lix just assumes that for--phase foo
the bash commandrunHook foo
is enough, but setup hooks that add or change phases don't all work the same way and I would be shocked if this wasn't already broken for various phases in Nixpkgs.I think this is a hard sell for Lix, and stdenv's phase handling could really use the extra friendliness already.
Maybe if we wanted to look at what would be a way forward for the semantic need of this issue: how can nixpkgs communicate to Nix information about its available phases, planned phases, ongoing phases and so on?
If a standard format is described and if we had (we don't) a standard protocol for the sandbox to report metadata to the driver subdaemon, we could do nifty things.
I surmise that getting right the standard format and what information is useful at the stdenv and nixpkgs level is going to be some long work (not a quick win, for sure; but a very much needed win.)
At the same time, Lix will be able to get progress on RPC and perhaps, we will get all the pieces to connect it together.
In other words:
nixpkgs does already send phase information of what phase it is currently on to $NIX_LOG_FD, but that's only if it is actually conducting a build and it does not include information about all involved phases. The reporter is mostly asking about how to inspect it without conducting a build, but I realize it would be really valuable in a build as well.