-
Notifications
You must be signed in to change notification settings - Fork 264
[nix] Show nix profile install progress #772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you share a screenshot or video of what this looks like now? Not sure I am picturing it correctly. IIRC we needed the custom writer to indent the lines...
Removing a package from global devbox is impossible if the nix package was not installed
what could add a package to devbox.json but have it be not installed?
@@ -216,14 +216,15 @@ func ProfileInstall(args *ProfileInstallArgs) error { | |||
cmd.Env = AllowUnfreeEnv() | |||
cmd.Args = append(cmd.Args, ExperimentalFlags()...) | |||
cmd.Args = append(cmd.Args, args.ExtraFlags...) | |||
cmd.Stdout = &PackageInstallWriter{args.Writer} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from ignoring some lines (which are no longer needed), I think we also needed this writer to indent the output:
_, err = io.WriteString(fw.Writer, "\t"+line+"\n")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We would need to specify stdout/stdin anyway because they default to /dev/null
. The convention is to check if the stderr file descriptor is a tty, which is what I'm guessing Nix does. As long as the command's stderr is an *os.File
pointing to a tty then it should work.
be4c391
to
20c8373
Compare
@savil it has to be a video or a gif because the output is dynamic inline. Which also means I don't think we need the indent to make it look good. Will share. |
I'm a bit too lazy to make a video, this is what it looks like: The lower line is dynamic and shows progress. this is what it looks like after installing multiple packages I went ahead and removed the redundant "package is now installed" and now it looks like Two weird behavior nits:
Will address this in follow up |
Summary
This shows inline progress when installing new packages (both global and local).
nix profile install
does this automatically but only in tty mode. @gcurtis curious if we can somehow make nix believe we're in tty mode without having to specify stdin and stdout?Removed 2 blockers that are no longer needed:
PackageInstallWriter
is no longer needed I don't think. It could not see the lines it was meant to supress.ProfileInstall
already defensivelly check if package exists. If the user somehow does end up trying to install a package that doesn't exist, we still show a decent errorFixed 2 semi-related errors:
How was it tested?