Skip to content

[wip/poc] impl: use flake for profile packages #1588

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

Closed
wants to merge 2 commits into from

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Oct 25, 2023

This is a proof-of-concept that changes devbox so that it uses the flake when installing packages to a profile. The idea is that this moves a lot of logic out of Devbox and into Nix, where things are more reproducible. It also makes the flake the single source of truth -- packages added to the flake automatically get added to the profile.

When running this in a project where most packages are already in the Nix store (and therefore most time is spent syncing the profile), this runs about a 2.3x faster:

$ cd ~/src/axiom
$ rm -rf .devbox
$ time devbox install # with this PR
Ensuring packages are installed.
✓ Computed the Devbox environment.
Finished installing packages.
devbox install  0.25s user 0.16s system 48% cpu 0.837 total
$ rm -rf .devbox
$ time devbox install # current main
Ensuring packages are installed.

Installing 12 packages: go@latest, buf@latest, python310@latest, sops@latest, kubernetes-helm@latest, postgresql@latest, nodejs@latest, yarn@latest, awscli2@latest, golangci-lint@latest, flyctl@latest, gotty@latest.

[1/12] go@latest
[1/12] go@latest: Success
[2/12] buf@latest
[2/12] buf@latest: Success
[3/12] python310@latest
[3/12] python310@latest: Success
[4/12] sops@latest
[4/12] sops@latest: Success
[5/12] kubernetes-helm@latest
[5/12] kubernetes-helm@latest: Success
[6/12] postgresql@latest
[6/12] postgresql@latest: Success
[7/12] nodejs@latest
[7/12] nodejs@latest: Success
[8/12] yarn@latest
[8/12] yarn@latest: Success
[9/12] awscli2@latest
[9/12] awscli2@latest: Success
[10/12] golangci-lint@latest
[10/12] golangci-lint@latest: Success
[11/12] flyctl@latest
[11/12] flyctl@latest: Success
[12/12] gotty@latest
[12/12] gotty@latest: Success
✓ Computed the Devbox environment.
Finished installing packages.
devbox install  0.69s user 0.53s system 62% cpu 1.958 total

So far it passes all tests except for two:

  1. The php testscript fails because the packages installed by the plugin get removed from the PATH by devbox. I'm assuming this is fixable.
  2. The unfree testscript fails because the new syncing logic doesn't output progress (because it's a poc).

This is a proof-of-concept that changes devbox so that it uses the flake
when installing packages to a profile. The idea is that this moves a lot
of logic out of Devbox and into Nix, where things are more reproducible.
It also makes the flake the single source of truth -- packages added to
the flake automatically get added to the profile.

When running this in a project where most packages are already in the
Nix store (and therefore most time is spent syncing the profile), this
runs about a 2.3x faster:

```
$ cd ~/src/axiom
$ rm -rf .devbox
$ time devbox install # with this PR
Ensuring packages are installed.
✓ Computed the Devbox environment.
Finished installing packages.
devbox install  0.25s user 0.16s system 48% cpu 0.837 total
$ rm -rf .devbox
$ time devbox install # current main
Ensuring packages are installed.

Installing 12 packages: go@latest, buf@latest, python310@latest, sops@latest, kubernetes-helm@latest, postgresql@latest, nodejs@latest, yarn@latest, awscli2@latest, golangci-lint@latest, flyctl@latest, gotty@latest.

[1/12] go@latest
[1/12] go@latest: Success
[2/12] buf@latest
[2/12] buf@latest: Success
[3/12] python310@latest
[3/12] python310@latest: Success
[4/12] sops@latest
[4/12] sops@latest: Success
[5/12] kubernetes-helm@latest
[5/12] kubernetes-helm@latest: Success
[6/12] postgresql@latest
[6/12] postgresql@latest: Success
[7/12] nodejs@latest
[7/12] nodejs@latest: Success
[8/12] yarn@latest
[8/12] yarn@latest: Success
[9/12] awscli2@latest
[9/12] awscli2@latest: Success
[10/12] golangci-lint@latest
[10/12] golangci-lint@latest: Success
[11/12] flyctl@latest
[11/12] flyctl@latest: Success
[12/12] gotty@latest
[12/12] gotty@latest: Success
✓ Computed the Devbox environment.
Finished installing packages.
devbox install  0.69s user 0.53s system 62% cpu 1.958 total
```

So far it passes all tests except for two:

1. The php testscript fails because the packages installed by the plugin
   get removed from the PATH by devbox. I'm assuming this is fixable.
2. The unfree testscript fails because the new syncing logic doesn't
   output progress (because it's a poc).
@gcurtis gcurtis closed this Nov 1, 2023
@savil savil reopened this Dec 22, 2023
@savil savil closed this Dec 22, 2023
@gcurtis gcurtis deleted the gcurtis/profile-poc branch February 6, 2024 06:24
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.

2 participants