Skip to content
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

[global] Unify nix profile install #695

Merged
merged 7 commits into from
Feb 28, 2023
Merged

Conversation

mikeland73
Copy link
Contributor

@mikeland73 mikeland73 commented Feb 27, 2023

Summary

This fixes a few global issues:

  • stdout not being attached when doing global install.
  • Prefetching (and printing) nixpkgs when needed

It does so by refactoring some code around:

  • Unify different ways of installing nix packages (local, global, and utility all use nix.ProfileInstall)
  • We now always check if nixpkgs is installed, improving messaging when we need to install it.
  • Moved some nix related stuff to nix packages (calling nix profile install, packageInstallIgnore, checking if nixpkgs is installed)

What this does not fix: If we install a very large package (e.g. bazel) we block on cmd.Run() and don't print any output. This affects all ways of installing.

How was it tested?

devbox global add go_1_20 hello nginx
devbox add go_1_19
devbox shell

Also tried changing hashes on global devbox.json, installing conflicting binaries, adding and removing large packages (e.g. pulumi, bazel, etc). Bazel was a bad experience.

Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a fix: see the priority problem below

return "5"
}
}
return "4"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the opposite: the raw packages from devbox.json get highest priority compared to packages from elsewhere like global packages.

the lower the number, the higher the priority....

stepMsg := fmt.Sprintf("[%d/%d] %s", stepNum, total, pkg)
if err := nix.ProfileInstall(&nix.ProfileInstallArgs{
CustomStepMessage: stepMsg,
NixpkgsCommit: plansdk.DefaultNixpkgsCommit,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this take the nixpkgs commit hash from the global devbox.json?

if err := ensureNixpkgsPrefetched(args.Writer, args.NixpkgsCommit); err != nil {
return err
}
stepMsg := args.Package
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stepMsg := fmt.Sprintf("Installing %s\n", args.Package)

mikeland73 added a commit that referenced this pull request Feb 28, 2023
## Summary

Fixes minor double error issue. (This was pulled out of
#695)

## How was it tested?

```bash
devbox global add hello
hello is now installed
Warning: the devbox global profile is not in your $PATH.

Add the following line to your shell's rcfile (e.g., ~/.bashrc or ~/.zshrc)
and restart your shell to fix this:

	eval "$(devbox global shellenv)"
```
mikeland73 added a commit that referenced this pull request Feb 28, 2023
## Summary

I'm running into some weird CICD resource issue on #695 so I'm splitting that up into smaller PRs.

## How was it tested?

```bash
devbox global add go_1_20
devbox add go_1_19
devbox shell
```
@mikeland73 mikeland73 changed the title [global] Set priority for global packages, unify nix profile install [global] Unify nix profile install Feb 28, 2023
@mikeland73 mikeland73 merged commit abc008c into main Feb 28, 2023
@mikeland73 mikeland73 deleted the landau/set-priority-unify branch February 28, 2023 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants