-
Notifications
You must be signed in to change notification settings - Fork 259
devpkg: allow multiple/non-default package outputs #1630
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.
Aside from adding the new feature, this is a really well done refactor. Nicely done!
This is relatively high risk so a few areas to test:
- Performance (when you have ~50 packages)
- Ensure runx works
- Hopefully most flake and package permutations are tested by our CICD, but we should smoke test a bit as well.
Update `devpkg.Package` to use `FlakeInstallable` instead of a URL so that it can correctly handle the flake outputs syntax. For example, `flake:nixpkgs#prometheus^out,cli`. Untangling parts of `devpkg` has been tricky, so this commit focuses on changing only the pieces necessary to replace `Package.URL` with `Package.installable`. There's still a lot more cleanup that can be done. Tested by adding/removing various flakes with and without outputs specified: ``` $ devbox add prometheus $ devbox run -- promtool --version promtool: command not found Error: error running script "promtool" in Devbox: exit status 127 $ devbox add flake:nixpkgs#prometheus $ devbox run -- promtool --version promtool: command not found Error: error running script "promtool" in Devbox: exit status 127 $ devbox add flake:nixpkgs#prometheus^out,cli $ devbox run -- promtool --version promtool, version 2.47.2 (branch: unknown, revision: unknown) build user: nix@nixpkgs build date: unknown go version: go1.21.3 platform: darwin/arm64 tags: builtinassets $ devbox add path:$HOME/src/tailscale/tailscale ```
f040251
to
0d63bb2
Compare
I've been testing out runx and various package combinations. I'll try doing a large project next for performance. |
I ran |
@@ -30,8 +30,36 @@ import ( | |||
// This Package will be aggregated into a specific "flake input" (see shellgen.flakeInput). | |||
type Package struct { | |||
plugins.BuiltIn | |||
url.URL |
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.
yes!!!
|
||
// We currently don't lock flake references in devbox.lock, so there's | ||
// nothing to resolve. | ||
pkg.resolve = sync.OnceValue(func() error { return nil }) |
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.
I don't understand the comment here. It makes sense in isolation, but why refer to flake references in devbox.lock
in this function? this function is used for all kinds of packages.
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 handle Devbox packages above starting on line 126. If the raw package name doesn't parse as a flake reference (err != nil) or it's a flake reference that could also be a Devbox package, then we assume it's a Devbox package and return. The code after assumes that raw
is a valid flakeref.
Depends on #1627 and #1629.
Update
devpkg.Package
to useFlakeInstallable
instead of a URL so that it can correctly handle the flake outputs syntax. For example,flake:nixpkgs#prometheus^out,cli
.Untangling parts of
devpkg
has been tricky, so this commit focuses on changing only the pieces necessary to replacePackage.URL
withPackage.installable
. There's still a lot more cleanup that can be done.Tested by adding/removing various flakes with and without outputs specified:
Related to #1431.