-
Notifications
You must be signed in to change notification settings - Fork 270
Build and Install Devbox via Flake #2308
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9b5f915
Install Devbox via Flake
Lagoja ba51372
Tweak workflow
Lagoja 7063cda
Cleanup flake and json
Lagoja 25724cc
add update-hash to tidy
Lagoja c5f65a1
test broken hash
Lagoja 0076d27
fix hash
Lagoja 6b61346
fix version
Lagoja 56c62df
Update flake.nix
Lagoja 60aa213
Apply suggestions from code review
Lagoja c60d73b
Version 0.13.2
Lagoja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,16 @@ jobs: | |
- uses: actions/checkout@v4 | ||
- uses: crate-ci/[email protected] | ||
|
||
flake-test: | ||
name: Test Flake Build | ||
if: github.ref != 'refs/heads/main' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@main | ||
- run: nix build . | ||
- run: ./result/bin/devbox version | ||
|
||
golangci-lint: | ||
strategy: | ||
matrix: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,7 @@ __pycache__/ | |
# deployment | ||
.vercel | ||
.yarn | ||
|
||
# Nix | ||
vendor/ | ||
result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
description = "Instant, easy, predictable shells and containers"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
|
||
lastTag = "0.13.1"; | ||
|
||
# Add the commit to the version string, in case someone builds from main | ||
getVersion = pkgs.lib.trivial.pipe self [ | ||
(x: "${lastTag}") | ||
(x: if (self ? revCount) | ||
then "${x}-${self.shortRev}" | ||
else "${x}-${self.dirtyShortRev}") | ||
]; | ||
|
||
# Run `devbox run update-flake` to update the vendorHash | ||
vendorHash = if builtins.pathExists ./vendor-hash | ||
then builtins.readFile ./vendor-hash | ||
else ""; | ||
|
||
buildGoModule = pkgs.buildGo123Module; | ||
|
||
in | ||
{ | ||
inherit self; | ||
packages.default = buildGoModule rec { | ||
pname = "devbox"; | ||
version = getVersion; | ||
|
||
src = ./.; | ||
|
||
inherit vendorHash; | ||
|
||
ldflags = [ | ||
"-s" | ||
"-w" | ||
"-X go.jetpack.io/devbox/internal/build.Version=${version}" | ||
]; | ||
|
||
# Disable tests if they require network access or are integration tests | ||
doCheck = false; | ||
|
||
nativeBuildInputs = [ pkgs.installShellFiles ]; | ||
|
||
postInstall = '' | ||
installShellCompletion --cmd devbox \ | ||
--bash <($out/bin/devbox completion bash) \ | ||
--fish <($out/bin/devbox completion fish) \ | ||
--zsh <($out/bin/devbox completion zsh) | ||
''; | ||
|
||
meta = with pkgs.lib; { | ||
description = "Instant, easy, predictable shells and containers"; | ||
Lagoja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
homepage = "https://www.jetpack.io/devbox"; | ||
Lagoja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
license = licenses.asl20; | ||
maintainers = with maintainers; [ lagoja ]; | ||
}; | ||
}; | ||
} | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sha256-rwmNzYzmZqNcNVV4GgqCVLT6ofIkblVCMJHLGwlhcGw= |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.