Skip to content

Conversation

mikeland73
Copy link
Contributor

@mikeland73 mikeland73 commented Feb 13, 2023

Summary

This "pulls" a global config either from a local path or URL. It merges the packages into the existing config.

How was it tested?

devbox global pull devbox.json
devbox global pull https://raw.githubusercontent.com/jetpack-io/devbox/main/devbox.json

@mikeland73 mikeland73 requested review from savil and gcurtis February 14, 2023 20:29
@mikeland73 mikeland73 marked this pull request as ready for review February 14, 2023 20:42
func globalPullCmd() *cobra.Command {
return &cobra.Command{
Use: "pull <file> | <url>",
Short: "Pulls a global config from a file or URL",
Copy link
Collaborator

Choose a reason for hiding this comment

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

it seems that url requires the scheme. That's non-obvious but very reasonable, so could we specify an example in the Long explanation?


func (d *Devbox) PullGlobal(path string) error {
u, err := url.Parse(path)
if err == nil && u.Scheme != "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

scheme requirement is here (ref. previous comment above)

return "", err
}
nixDirPath := filepath.Join(configPath, "nix")
_ = os.MkdirAll(nixDirPath, 0755)
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets check the err

@mikeland73
Copy link
Contributor Author

@savil to avoid rebase conflicts, I addressed your comments in #637

I'll merge both at same time.

@mikeland73 mikeland73 merged commit 2f532b6 into main Feb 15, 2023
@mikeland73 mikeland73 deleted the landau/global-pull branch February 15, 2023 05:57
mikeland73 added a commit that referenced this pull request Feb 15, 2023
## Summary

This is stacked on #630

This moves global data to XDG_DATA_HOME or `~/.local/share`

* The devbox.json is stored in
`~/.local/share/devbox/global/default/devbox.json`
* The nix profile is in
`~/.local/share/devbox/global/default/nix-profile`
* the bin path is `~/.local/share/devbox/global/current/nix-profile/bin`

## How was it tested?

`devbox global add hello`
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