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

Install Devbox Using Flakes #725

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

Install Devbox Using Flakes #725

wants to merge 7 commits into from

Conversation

Lagoja
Copy link
Contributor

@Lagoja Lagoja commented Mar 7, 2023

Context

We currently publish Devbox as a package in the nixpkg repository, but this version is often far behind our latest released version. For example: 22.11 currently has devbox 0.1.0, while unstable has devbox 0.3.4 (we're on 0.4.2 as of this PR).

By publishing a flake, we could make it easier for developers using NixOS, Nixpkg, or Home Manager to install Devbox on their system. Developers could add our repo + release tags as an input, and then have access to the latest versions as soon as we publish them.

With this installed, developers using Nix could install devbox with something like

nix build github:jetpack-io/devbox/latest

or adding

{
  inputs = {
         devbox.url = "github:jetpack-io/devbox/latest";
   ...
  };
...
}

to their flake.

Changes / Limitations with this PR:

  1. go.mod Hashes - We need to provide Nix with a sha256 of our vendored dependencies in order to build Devbox. We can do this by either adding a vendorSHA256 to our Flake, or using gomod2nix to generate a module with the hashes of all the dependencies in our go.mod file. This PR goes with the gomod2nix approach.

  2. Version Number - The version number currently needs to be set and updated manually in the Flake. This is because Flake outputs don't have access to the repositories branches or tags. We could pull this version from a file in the repo, or by running a script that reads the tags.

  3. Branch/Refs - To make it easy to install the latest version, we'll need a ref in our git repo for latest or stable. This could be a branch or a tag, and should be updated whenever we make a new full release.

How was it tested?

  • aarch64-linux
  • x86_64-linux
  • aarch64-darwin
  • x86_64-darwin
  • WSL2

With nix command and flakes enabled:

  • nix build
  • nix flake

@adamdicarlo0
Copy link
Contributor

I made https://github.com/adamdicarlo/devbox-nix-flake to use until this PR is completed - in case that helps anyone else. (Currently, devbox in nixpkgs is up to date, but this flake allows me to get the very latest release before nixpkgs gets updated.)

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.

None yet

5 participants