Skip to content

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Nov 9, 2022

Summary

This is the beginnings of a new API that allows Devbox to query the Nix store without needing to call out to the nix command. So far, it can list installed packages and determine their dependencies.

go doc summary of the new types:

type PackageStore struct {
	fs.FS
	// Has unexported fields.
}
    PackageStore is a file system containing packages that are compatible with
    Devbox.

func LocalNixStore(path string) *PackageStore
func (p *PackageStore) Package(name string) (Package, error)

type Package struct {
	fs.FS

	// Name is the full name of the package that is unique to its store.
	Name string

	// DirectDependencies are the other packages in the store that this
	// package depends on. It does not contain transitive dependencies.
	DirectDependencies []Package
}
    Package is a file system that contains a package's files and metadata.

The go.mod + go.sum changes are from a go get -u ./... && go mod tidy.

How was it tested?

go test

This is the beginnings of a new API that allows Devbox to query the Nix
store without needing to call out to the nix command. So far, it can
list installed packages and determine their dependencies.

`go doc` summary of the new types:

	type PackageStore struct {
		fs.FS
		// Has unexported fields.
	}
	    PackageStore is a file system containing packages that are compatible with
	    Devbox.

	func LocalNixStore(path string) *PackageStore
	func (p *PackageStore) Package(name string) (Package, error)

	type Package struct {
		fs.FS

		// Name is the full name of the package that is unique to its store.
		Name string

		// DirectDependencies are the other packages in the store that this
		// package depends on. It does not contain transitive dependencies.
		DirectDependencies []Package
	}
	    Package is a file system that contains a package's files and metadata.

The go.mod + go.sum changes are from a `go get -u ./... && go mod tidy`.
@gcurtis gcurtis requested a review from loreto November 9, 2022 23:18
Copy link
Contributor

@loreto loreto left a comment

Choose a reason for hiding this comment

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

LGTM.

But see thoughts below.

@gcurtis gcurtis merged commit c009546 into main Nov 10, 2022
@gcurtis gcurtis deleted the gcurtis/pkgdeps branch November 10, 2022 21:19
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