jetify-com / devbox

Instant, easy, and predictable development environments
https://www.jetify.com/devbox/
Apache License 2.0
7.82k stars 186 forks source link

Privately hosted Devbox Plugins on non-Github Git Servers #2048

Open Bee-Mar opened 1 month ago

Bee-Mar commented 1 month ago

What problem are you trying to solve?

Devbox plugins are great, however I would like to retrieve privately hosted Devbox plugins that are stored on my Gitlab server. If this is possible, it's not clear how to go about using the correct address & protocol. It doesn't appear Devbox even supports public facing plugins hosted on Gitlab.

What solution would you like?

Support the same protocols and syntax flakes currently do:

ie.:

{
  "packages:": [],
  "include:" [
     "git+ssh://git@gitlab.private-server.com/devbox-plugins/my-plugin?dir=test"
  ]
}

Alternatives you've considered

If this is not currently supported, I'm more than happy to create a PR with the feature.

Lagoja commented 1 month ago

I think Gitlab is supported, but the flake reference is a little different. I'm looking at the Docs here:

https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html

Since GitLab allows for self-hosting, you can specify host as a parameter, to point to any instances other than gitlab.com.

Some examples:

gitlab:veloren/veloren
gitlab:veloren/veloren/master
gitlab:veloren/veloren/80a4d7f13492d916e47d6195be23acae8001985a
gitlab:openldap/openldap?host=git.openldap.org

So I think the right reference for your private hosted Gitlab would be:

gitlab:devbox-plugins/my-plugin?host=gitlab.private-server.com&dir=test

If this doesn't work, we'd definitely welcome a pull request to add the support

Bee-Mar commented 1 month ago

@Lagoja thank you for the recommendation. My exact situation adds some complexity since the GitLab server I'm attempting to access is done via tunnel using the aws ssm start-session subcommand (I don't expect awareness/understanding of that CLI). However, it unfortunately seems that using the a scheme other than gitlab returns an error of the form:

Error: unsupported flake reference URL scheme: X

After starting the tunnel, repos are cloned using git clone ssh://git@localhost:1234/namespace/repo (the port may differ), and attempted this:

{
  // other sections in the devbox.json
  "include:" [
     "gitlab:namespace/repo?host=localhost:1234&dir=plugin"
  ]
 // other sections in the devbox.json
}

Below are a few of the others I tried, and returned a message of Error: unsupported flake reference URL scheme: X or Error: unsupported ref type "X".

"git+ssh:namespace/repo?host=localhost:1234&dir=plugin"
"git+ssh://namespace/repo?host=localhost:1234&dir=plugin"

"gitlab+ssh:namespace/repo?host=localhost:1234&dir=plugin"
"gitlab+ssh://namespace/repo?host=localhost:1234&dir=plugin"

"ssh:namespace/repo?host=localhost:1234&dir=plugin"\
"ssh://namespace/repo?host=localhost:1234&dir=plugin"

"git:namespace/repo?host=localhost:1234&dir=plugin"
"git://namespace/repo?host=localhost:1234&dir=plugin"

It does seem like I'll need to create a PR to support the additional scheme. Also, just as an FYI, I'm using devbox version 0.10.5

Bee-Mar commented 1 month ago

@Lagoja currently working on an implementation, and will submit a PR ASAP

Bee-Mar commented 9 hours ago

@Lagoja just an FYI, I have the implementation working after much delay with work and personal stuff. A PR should be coming in the next week or so.