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

internal/devpkg: add PackageSpec for parsing package strings #1878

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Jul 7, 2024

  1. internal/devconfig: add PackageSpec for parsing package strings

    Attempt to formalize raw Devbox package strings (hereby called package
    specs) by introducing a new `PackageSpec` type.
    
    This commit just adds the new parsing logic, it doesn't integrate it
    with any other code yet. The `PackageSpec` type is the result of parsing
    a raw string with `ParsePackageSpec`:
    
    	type PackageSpec struct {
    		Name, Version       string
    		Installable         flake.Installable
    		AttrPathInstallable flake.Installable
    		RunX                types.PkgRef
    	}
    
    	func ParsePackageSpec(raw, nixpkgsCommit string) PackageSpec
    
    When a package spec is ambiguous, `ParsePackageSpec` will populate the
    `PackageSpec` fields with all possible interpretations. For example, the
    spec `go` could be `go@latest`, a flake named `go`, or the attribute
    path `nixpkgs#go`. It's up to a resolver to try them in some priority
    order and pick one.
    gcurtis committed Jul 7, 2024
    Configuration menu
    Copy the full SHA
    58c57a9 View commit details
    Browse the repository at this point in the history