shared understanding of phases with nixpkgs #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
awaiting
author
awaiting
contributors
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
Feature/S3
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
5 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
*Phaseshell functions / scripts.This works, but is quite magic.
Describe the solution you'd like
We already have
nix develop --unpackand 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 $PHASEhas 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 developany 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
printPhasesfunction should exist in stdenv? Should stdenv have a way of jamming some debugging shell hooks intonix developshells?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
--unpackare 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 knowpytestdoesn't run incheckPhaseorinstallCheckPhase?). Lix just assumes that for--phase foothe bash commandrunHook foois 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.
in the current nixpkgs architecture it is in general impossible to know which phases will be run without running them since hooks are loaded dynamically and may or may not inject themselves into a build depending on circumstances lix cannot inspect any earlier than the hook scripts can. a
printPhasesor something in nixpkgs would sidestep this by turning a real build into a fake one that only prints the phases, but that too comes at the cost of realizing all inputs and is thus probably not a good idea.in our view this is first and foremost a nixpkgs architecture problem, not a lix problem. if we do turn this into a lix problem we should think about more general solutions that let us lift the phases array into a lix build graph.
Getting the lix phases lifted into a lix build graph would be Wonderfull. That would neatly facilitate re-running and developing on failing phases.
But that also sounds like a huge Chunk of work, that nixpkgs would have to participate in. Or am I missing something?
Correct assessment; this issue can basically be closed WONTFIX due to the extended timelines on which it is remotely likely for that to happen. It's pretty pie in the sky for implementation complexity, current dev capacity, and high coordination complexity.
Your immediate question is likely to need to be answered by nixpkgs without any lix involvement.
nix develop --show-phasesto shared understanding of phases with nixpkgsI have started with a pull request in nixpkgs to maybe expose an API to make this possible