|
1 | 1 | { |
2 | | - "name": "devbox", |
| 2 | + "name": "devbox", |
3 | 3 | "description": "Instant, easy, and predictable development environments", |
4 | 4 | "packages": { |
5 | | - "go": "latest", |
| 5 | + "go": "latest", |
6 | 6 | "runx:golangci/golangci-lint": "latest", |
7 | | - "runx:mvdan/gofumpt": "latest", |
| 7 | + "runx:mvdan/gofumpt": "latest" |
8 | 8 | }, |
9 | 9 | "env": { |
10 | 10 | "GOENV": "off", |
11 | | - "PATH": "$PATH:$PWD/dist", |
| 11 | + "PATH": "$PATH:$PWD/dist" |
12 | 12 | }, |
13 | 13 | "shell": { |
14 | 14 | "init_hook": [ |
15 | 15 | // Remove Go environment variables that might've been inherited from the |
16 | 16 | // user's environment and could affect the build. |
17 | 17 | "test -z $FISH_VERSION && \\", |
18 | 18 | "unset CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS GOROOT GOTOOLCHAIN GOWORK || \\", |
19 | | - "set --erase CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS GOROOT GOTOOLCHAIN GOWORK", |
| 19 | + "set --erase CGO_ENABLED GO111MODULE GOARCH GOFLAGS GOMOD GOOS GOROOT GOTOOLCHAIN GOWORK" |
20 | 20 | ], |
21 | 21 | "scripts": { |
22 | 22 | // Build devbox for the current platform |
23 | | - "build": "go build -o dist/devbox ./cmd/devbox", |
| 23 | + "build": "go build -o dist/devbox ./cmd/devbox", |
24 | 24 | "build-darwin-amd64": "GOOS=darwin GOARCH=amd64 go build -o dist/devbox-darwin-amd64 ./cmd/devbox", |
25 | 25 | "build-darwin-arm64": "GOOS=darwin GOARCH=arm64 go build -o dist/devbox-darwin-arm64 ./cmd/devbox", |
26 | | - "build-linux-amd64": "GOOS=linux GOARCH=amd64 go build -o dist/devbox-linux-amd64 ./cmd/devbox", |
27 | | - "build-linux-arm64": "GOOS=linux GOARCH=arm64 go build -o dist/devbox-linux-arm64 ./cmd/devbox", |
| 26 | + "build-linux-amd64": "GOOS=linux GOARCH=amd64 go build -o dist/devbox-linux-amd64 ./cmd/devbox", |
| 27 | + "build-linux-arm64": "GOOS=linux GOARCH=arm64 go build -o dist/devbox-linux-arm64 ./cmd/devbox", |
28 | 28 | "build-all": [ |
29 | 29 | "devbox run build-darwin-amd64", |
30 | 30 | "devbox run build-darwin-arm64", |
31 | 31 | "devbox run build-linux-amd64", |
32 | | - "devbox run build-linux-arm64", |
| 32 | + "devbox run build-linux-arm64" |
33 | 33 | ], |
34 | 34 | // Open VSCode |
35 | | - "code": "code .", |
36 | | - "lint": "golangci-lint run --timeout 5m && scripts/gofumpt.sh", |
37 | | - "fmt": "scripts/gofumpt.sh", |
38 | | - "test": "go test -race -cover ./...", |
| 35 | + "code": "code .", |
| 36 | + "lint": "golangci-lint run --timeout 5m && scripts/gofumpt.sh", |
| 37 | + "fmt": "scripts/gofumpt.sh", |
| 38 | + "test": "go test -race -cover ./...", |
39 | 39 | "test-projects-only": "DEVBOX_RUN_PROJECT_TESTS=1 go test -v -timeout ${DEVBOX_GOLANG_TEST_TIMEOUT:-30m} ./... -run \"TestExamples|TestScriptsWithProjects\"", |
40 | | - "update-examples": "devbox run build && go run testscripts/testrunner/updater/main.go", |
41 | | - "tidy": "go mod tidy", |
42 | | - |
| 40 | + "update-examples": "devbox run build && go run testscripts/testrunner/updater/main.go", |
| 41 | + // Updates the Flake's vendorHash: First run `go mod vendor` to vendor |
| 42 | + // the dependencies, then hash the vendor directory with Nix. |
| 43 | + // The hash is saved to the `vendor-hash` file, which is then |
| 44 | + // read into the Nix Flake. |
| 45 | + "update-hash": [ |
| 46 | + // realpath to work-around nix hash not liking symlinks |
| 47 | + "vendor=$(realpath $(mktemp -d))", |
| 48 | + "trap \"rm -rf $vendor\" EXIT", |
| 49 | + "go mod vendor -o $vendor", |
| 50 | + "nix hash path $vendor >vendor-hash", |
| 51 | + ], |
| 52 | + "tidy": ["go mod tidy", "devbox run update-hash"], |
43 | 53 | // docker-testscripts runs the testscripts with Docker to exercise |
44 | 54 | // Linux-specific tests. It invokes the test binary directly, so any extra |
45 | 55 | // test runner flags must have their "-test." prefix. |
|
58 | 68 | "GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go test -c -o testscripts-linux-amd64", |
59 | 69 | "GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go test -c -o testscripts-linux-arm64", |
60 | 70 | "image=$(docker build --quiet --tag devbox-testscripts-ubuntu:noble --platform linux/amd64 .)", |
61 | | - "docker run --rm --mount type=volume,src=devbox-testscripts-amd64,dst=/nix --platform linux/amd64 -e DEVBOX_RUN_FAILING_TESTS -e DEVBOX_RUN_PROJECT_TESTS -e DEVBOX_DEBUG $image \"$@\"", |
62 | | - ], |
63 | | - }, |
64 | | - }, |
| 71 | + "docker run --rm --mount type=volume,src=devbox-testscripts-amd64,dst=/nix --platform linux/amd64 -e DEVBOX_RUN_FAILING_TESTS -e DEVBOX_RUN_PROJECT_TESTS -e DEVBOX_DEBUG $image \"$@\"" |
| 72 | + ] |
| 73 | + } |
| 74 | + } |
65 | 75 | } |
0 commit comments