mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
feat(flake.nix): switch dogfood dev image to buildNixShellImage from dockerTools (#16223)
Replace Depot build action with Nix for Nix dogfood image builds The dogfood Nix image is now built using Nix's native container tooling instead of Depot. This change: - Adds Nix setup steps to the GitHub Actions workflow - Removes the Dockerfile.nix in favor of a Nix-native container build - Updates the flake.nix to support building Docker images - Introduces a hash file to track Nix-related changes - Updates the vendorHash for Go dependencies Change-Id: I4e011fe3a19d9a1375fbfd5223c910e59d66a5d9 Signed-off-by: Thomas Kosiewski <tk@coder.com>
This commit is contained in:
@ -1,6 +0,0 @@
|
||||
# Ignore all files and folders
|
||||
**
|
||||
|
||||
# Include flake.nix and flake.lock
|
||||
!flake.nix
|
||||
!flake.lock
|
2
.github/actions/setup-sqlc/action.yaml
vendored
2
.github/actions/setup-sqlc/action.yaml
vendored
@ -7,4 +7,4 @@ runs:
|
||||
- name: Setup sqlc
|
||||
uses: sqlc-dev/setup-sqlc@c0209b9199cd1cce6a14fc27cabcec491b651761 # v4.0.0
|
||||
with:
|
||||
sqlc-version: "1.25.0"
|
||||
sqlc-version: "1.27.0"
|
||||
|
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
@ -251,16 +251,16 @@ jobs:
|
||||
- name: go install tools
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
|
||||
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
|
||||
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/mikefarah/yq/v4@v4.30.6
|
||||
go install go.uber.org/mock/mockgen@v0.4.0
|
||||
go install github.com/mikefarah/yq/v4@v4.44.3
|
||||
go install go.uber.org/mock/mockgen@v0.5.0
|
||||
|
||||
- name: Install Protoc
|
||||
run: |
|
||||
mkdir -p /tmp/proto
|
||||
pushd /tmp/proto
|
||||
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
|
||||
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip
|
||||
unzip protoc.zip
|
||||
cp -r ./bin/* /usr/local/bin
|
||||
cp -r ./include /usr/local/bin/include
|
||||
@ -850,7 +850,7 @@ jobs:
|
||||
run: |
|
||||
mkdir -p /tmp/proto
|
||||
pushd /tmp/proto
|
||||
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
|
||||
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip
|
||||
unzip protoc.zip
|
||||
cp -r ./bin/* /usr/local/bin
|
||||
cp -r ./include /usr/local/bin/include
|
||||
@ -862,10 +862,10 @@ jobs:
|
||||
- name: Install go tools
|
||||
run: |
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
|
||||
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
|
||||
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34
|
||||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
go install github.com/mikefarah/yq/v4@v4.30.6
|
||||
go install go.uber.org/mock/mockgen@v0.4.0
|
||||
go install github.com/mikefarah/yq/v4@v4.44.3
|
||||
go install go.uber.org/mock/mockgen@v0.5.0
|
||||
|
||||
- name: Setup sqlc
|
||||
uses: ./.github/actions/setup-sqlc
|
||||
|
35
.github/workflows/dogfood.yaml
vendored
35
.github/workflows/dogfood.yaml
vendored
@ -24,7 +24,7 @@ permissions:
|
||||
jobs:
|
||||
build_image:
|
||||
if: github.actor != 'dependabot[bot]' # Skip Dependabot PRs
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || 'ubuntu-latest' }}
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
|
||||
@ -34,6 +34,12 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||
|
||||
- name: Setup Nix
|
||||
uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16
|
||||
|
||||
- name: Setup GHA Nix cache
|
||||
uses: DeterminateSystems/magic-nix-cache-action@6221693898146dc97e38ad0e013488a16477a4c4 # v9
|
||||
|
||||
- name: Get branch name
|
||||
id: branch-name
|
||||
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8.0.1
|
||||
@ -71,18 +77,21 @@ jobs:
|
||||
push: ${{ github.ref == 'refs/heads/main' }}
|
||||
tags: "codercom/oss-dogfood:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood:latest"
|
||||
|
||||
- name: Build and push Nix image
|
||||
uses: depot/build-push-action@636daae76684e38c301daa0c5eca1c095b24e780 # v1.14.0
|
||||
with:
|
||||
project: b4q6ltmpzh
|
||||
token: ${{ secrets.DEPOT_TOKEN }}
|
||||
buildx-fallback: true
|
||||
context: "."
|
||||
file: "dogfood/contents/Dockerfile.nix"
|
||||
pull: true
|
||||
save: true
|
||||
push: ${{ github.ref == 'refs/heads/main' }}
|
||||
tags: "codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood-nix:latest"
|
||||
- name: Build Nix image
|
||||
run: nix build .#dev_image
|
||||
|
||||
- name: Push Nix image
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
docker load -i result
|
||||
|
||||
CURRENT_SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')
|
||||
|
||||
docker image tag codercom/oss-dogfood-nix:latest-$CURRENT_SYSTEM codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }}
|
||||
docker image push codercom/oss-dogfood-nix:${{ steps.docker-tag-name.outputs.tag }}
|
||||
|
||||
docker image tag codercom/oss-dogfood-nix:latest-$CURRENT_SYSTEM codercom/oss-dogfood-nix:latest
|
||||
docker image push codercom/oss-dogfood-nix:latest
|
||||
|
||||
deploy_template:
|
||||
needs: build_image
|
||||
|
6
.github/workflows/security.yaml
vendored
6
.github/workflows/security.yaml
vendored
@ -86,13 +86,13 @@ jobs:
|
||||
uses: ./.github/actions/setup-sqlc
|
||||
|
||||
- name: Install yq
|
||||
run: go run github.com/mikefarah/yq/v4@v4.30.6
|
||||
run: go run github.com/mikefarah/yq/v4@v4.44.3
|
||||
- name: Install mockgen
|
||||
run: go install go.uber.org/mock/mockgen@v0.4.0
|
||||
run: go install go.uber.org/mock/mockgen@v0.5.0
|
||||
- name: Install protoc-gen-go
|
||||
run: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30
|
||||
- name: Install protoc-gen-go-drpc
|
||||
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33
|
||||
run: go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34
|
||||
- name: Install Protoc
|
||||
run: |
|
||||
# protoc must be in lockstep with our dogfood Dockerfile or the
|
||||
|
3
Makefile
3
Makefile
@ -957,3 +957,6 @@ else
|
||||
pnpm playwright:test
|
||||
endif
|
||||
.PHONY: test-e2e
|
||||
|
||||
dogfood/contents/nix.hash: flake.nix flake.lock
|
||||
sha256sum flake.nix flake.lock >./dogfood/contents/nix.hash
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v4.23.3
|
||||
// protoc v4.23.4
|
||||
// source: agent/proto/agent.proto
|
||||
|
||||
package proto
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||
// protoc-gen-go-drpc version: v0.0.33
|
||||
// protoc-gen-go-drpc version: v0.0.34
|
||||
// source: agent/proto/agent.proto
|
||||
|
||||
package proto
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// sqlc v1.27.0
|
||||
|
||||
package database
|
||||
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
type MockPubsub struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockPubsubMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockPubsubMockRecorder is the mock recorder for MockPubsub.
|
||||
@ -54,45 +55,45 @@ func (mr *MockPubsubMockRecorder) Close() *gomock.Call {
|
||||
}
|
||||
|
||||
// Publish mocks base method.
|
||||
func (m *MockPubsub) Publish(arg0 string, arg1 []byte) error {
|
||||
func (m *MockPubsub) Publish(event string, message []byte) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Publish", arg0, arg1)
|
||||
ret := m.ctrl.Call(m, "Publish", event, message)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Publish indicates an expected call of Publish.
|
||||
func (mr *MockPubsubMockRecorder) Publish(arg0, arg1 any) *gomock.Call {
|
||||
func (mr *MockPubsubMockRecorder) Publish(event, message any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Publish", reflect.TypeOf((*MockPubsub)(nil).Publish), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Publish", reflect.TypeOf((*MockPubsub)(nil).Publish), event, message)
|
||||
}
|
||||
|
||||
// Subscribe mocks base method.
|
||||
func (m *MockPubsub) Subscribe(arg0 string, arg1 pubsub.Listener) (func(), error) {
|
||||
func (m *MockPubsub) Subscribe(event string, listener pubsub.Listener) (func(), error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Subscribe", arg0, arg1)
|
||||
ret := m.ctrl.Call(m, "Subscribe", event, listener)
|
||||
ret0, _ := ret[0].(func())
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Subscribe indicates an expected call of Subscribe.
|
||||
func (mr *MockPubsubMockRecorder) Subscribe(arg0, arg1 any) *gomock.Call {
|
||||
func (mr *MockPubsubMockRecorder) Subscribe(event, listener any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subscribe", reflect.TypeOf((*MockPubsub)(nil).Subscribe), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subscribe", reflect.TypeOf((*MockPubsub)(nil).Subscribe), event, listener)
|
||||
}
|
||||
|
||||
// SubscribeWithErr mocks base method.
|
||||
func (m *MockPubsub) SubscribeWithErr(arg0 string, arg1 pubsub.ListenerWithErr) (func(), error) {
|
||||
func (m *MockPubsub) SubscribeWithErr(event string, listener pubsub.ListenerWithErr) (func(), error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SubscribeWithErr", arg0, arg1)
|
||||
ret := m.ctrl.Call(m, "SubscribeWithErr", event, listener)
|
||||
ret0, _ := ret[0].(func())
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// SubscribeWithErr indicates an expected call of SubscribeWithErr.
|
||||
func (mr *MockPubsubMockRecorder) SubscribeWithErr(arg0, arg1 any) *gomock.Call {
|
||||
func (mr *MockPubsubMockRecorder) SubscribeWithErr(event, listener any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeWithErr", reflect.TypeOf((*MockPubsub)(nil).SubscribeWithErr), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeWithErr", reflect.TypeOf((*MockPubsub)(nil).SubscribeWithErr), event, listener)
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// sqlc v1.27.0
|
||||
|
||||
package database
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// sqlc v1.27.0
|
||||
|
||||
package database
|
||||
|
||||
|
@ -38,7 +38,7 @@ RUN apt-get update && \
|
||||
# protoc-gen-go is needed to build sysbox from source
|
||||
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.30 && \
|
||||
# drpc support for v2
|
||||
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.33 && \
|
||||
go install storj.io/drpc/cmd/protoc-gen-go-drpc@v0.0.34 && \
|
||||
# migrate for migration support for v2
|
||||
go install github.com/golang-migrate/migrate/v4/cmd/migrate@v4.15.1 && \
|
||||
# goreleaser for compiling v2 binaries
|
||||
@ -57,7 +57,7 @@ RUN apt-get update && \
|
||||
# charts and values files
|
||||
go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.5.0 && \
|
||||
# sqlc for Go code generation
|
||||
(CGO_ENABLED=1 go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.25.0) && \
|
||||
(CGO_ENABLED=1 go install github.com/sqlc-dev/sqlc/cmd/sqlc@v1.27.0) && \
|
||||
# gcr-cleaner-cli used by CI to prune unused images
|
||||
go install github.com/sethvargo/gcr-cleaner/cmd/gcr-cleaner-cli@v0.5.1 && \
|
||||
# ruleguard for checking custom rules, without needing to run all of
|
||||
@ -75,9 +75,9 @@ RUN apt-get update && \
|
||||
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.35.1 && \
|
||||
# yq v4 is used to process yaml files in coder v2. Conflicts with
|
||||
# yq v3 used in v1.
|
||||
go install github.com/mikefarah/yq/v4@v4.30.6 && \
|
||||
go install github.com/mikefarah/yq/v4@v4.44.3 && \
|
||||
mv /tmp/bin/yq /tmp/bin/yq4 && \
|
||||
go install go.uber.org/mock/mockgen@v0.4.0 && \
|
||||
go install go.uber.org/mock/mockgen@v0.5.0 && \
|
||||
# Reduce image size.
|
||||
apt-get remove --yes gcc && \
|
||||
apt-get autoremove --yes && \
|
||||
@ -90,7 +90,7 @@ RUN apt-get update && \
|
||||
FROM gcr.io/coder-dev-1/alpine:3.18 as proto
|
||||
WORKDIR /tmp
|
||||
RUN apk add curl unzip
|
||||
RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip && \
|
||||
RUN curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip && \
|
||||
unzip protoc.zip && \
|
||||
rm protoc.zip
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
# Build stage
|
||||
FROM nixos/nix:2.19.2 AS nix
|
||||
|
||||
# enable --experimental-features 'nix-command flakes' globally
|
||||
# nix does not enable these features by default these are required to run commands like
|
||||
# nix develop -c 'some command' or to use falke.nix
|
||||
RUN mkdir -p /etc/nix && \
|
||||
echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
|
||||
|
||||
# Copy Nix flake and install dependencies
|
||||
COPY flake.* /app/
|
||||
RUN nix profile install "/app#all" --priority 4 && \
|
||||
rm -rf /app && \
|
||||
nix-collect-garbage -d
|
||||
|
||||
# Final image
|
||||
FROM codercom/enterprise-base:latest AS final
|
||||
|
||||
# Set the non-root user
|
||||
USER root
|
||||
|
||||
# Copy the Nix related files into the Docker image
|
||||
COPY --from=nix --chown=coder:coder /nix /nix
|
||||
COPY --from=nix /etc/nix /etc/nix
|
||||
COPY --from=nix --chown=coder:coder /root/.nix-profile /home/coder/.nix-profile
|
||||
COPY --from=nix /etc/passwd /etc/passwd.nix
|
||||
COPY --from=nix /etc/group /etc/group.nix
|
||||
|
||||
# Merge the passwd and group files
|
||||
# We need all nix users and groups to be available in the final image
|
||||
RUN cat /etc/passwd.nix >> /etc/passwd && \
|
||||
cat /etc/group.nix >> /etc/group && \
|
||||
rm /etc/passwd.nix /etc/group.nix
|
||||
|
||||
# Set environment variables and PATH
|
||||
ENV PATH=/home/coder/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:$PATH \
|
||||
GOPRIVATE="coder.com,cdr.dev,go.coder.com,github.com/cdr,github.com/coder" \
|
||||
NODE_OPTIONS="--max-old-space-size=8192"
|
||||
|
||||
# Set the user to 'coder'
|
||||
USER coder
|
||||
WORKDIR /home/coder
|
@ -351,7 +351,7 @@ resource "docker_image" "dogfood" {
|
||||
data.docker_registry_image.dogfood.sha256_digest,
|
||||
sha1(join("", [for f in fileset(path.module, "files/*") : filesha1(f)])),
|
||||
filesha1("Dockerfile"),
|
||||
filesha1("Dockerfile.nix"),
|
||||
filesha1("nix.hash"),
|
||||
]
|
||||
keep_locally = true
|
||||
}
|
||||
|
2
dogfood/contents/nix.hash
Normal file
2
dogfood/contents/nix.hash
Normal file
@ -0,0 +1,2 @@
|
||||
91e81c240fcf9f72e4c67497b68ba247a3f901147b61736072eb234e03db87b5 flake.nix
|
||||
b43d86368a0d2713d646d57e964dc2ac49744f5e11b6395fabed2d49596c1615 flake.lock
|
8
flake.lock
generated
8
flake.lock
generated
@ -44,16 +44,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1736883708,
|
||||
"narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=",
|
||||
"lastModified": 1737885640,
|
||||
"narHash": "sha256-GFzPxJzTd1rPIVD4IW+GwJlyGwBDV1Tj5FLYwDQQ9sM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eb62e6aa39ea67e0b8018ba8ea077efe65807dc8",
|
||||
"rev": "4e96537f163fad24ed9eb317798a79afc85b51b7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
100
flake.nix
100
flake.nix
@ -2,7 +2,7 @@
|
||||
description = "Development environments on your infrastructure";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
nixpkgs-pinned.url = "github:nixos/nixpkgs/5deee6281831847857720668867729617629ef1f";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
pnpm2nix = {
|
||||
@ -17,8 +17,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixpkgs-pinned, flake-utils, drpc, pnpm2nix }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-pinned,
|
||||
flake-utils,
|
||||
drpc,
|
||||
pnpm2nix,
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
@ -32,6 +41,8 @@
|
||||
inherit system;
|
||||
};
|
||||
|
||||
formatter = pkgs.nixfmt-rfc-style;
|
||||
|
||||
nodejs = pkgs.nodejs_20;
|
||||
pnpm = pkgs.pnpm_9.override {
|
||||
inherit nodejs; # Ensure it points to the above nodejs version
|
||||
@ -42,7 +53,9 @@
|
||||
# to update the lock file if packages are out-of-date.
|
||||
|
||||
# From https://nixos.wiki/wiki/Google_Cloud_SDK
|
||||
gdk = pkgs.google-cloud-sdk.withExtraComponents ([ pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin ]);
|
||||
gdk = pkgs.google-cloud-sdk.withExtraComponents [
|
||||
pkgs.google-cloud-sdk.components.gke-gcloud-auth-plugin
|
||||
];
|
||||
|
||||
proto_gen_go_1_30 = pkgs.buildGoModule rec {
|
||||
name = "protoc-gen-go";
|
||||
@ -50,9 +63,7 @@
|
||||
repo = "protobuf-go";
|
||||
rev = "v1.30.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "protocolbuffers";
|
||||
repo = "protobuf-go";
|
||||
rev = rev;
|
||||
inherit owner repo rev;
|
||||
# Updated with ./scripts/update-flake.sh`.
|
||||
sha256 = "sha256-GTZQ40uoi62Im2F4YvlZWiSNNJ4fEAkRojYa0EYz9HU=";
|
||||
};
|
||||
@ -63,14 +74,16 @@
|
||||
# The minimal set of packages to build Coder.
|
||||
devShellPackages = with pkgs; [
|
||||
# google-chrome is not available on aarch64 linux
|
||||
(lib.optionalDrvAttr ( !stdenv.isLinux || !stdenv.isAarch64 ) google-chrome)
|
||||
(lib.optionalDrvAttr (!stdenv.isLinux || !stdenv.isAarch64) google-chrome)
|
||||
# strace is not available on OSX
|
||||
(lib.optionalDrvAttr ( !pkgs.stdenv.isDarwin ) strace)
|
||||
(lib.optionalDrvAttr (!pkgs.stdenv.isDarwin) strace)
|
||||
bat
|
||||
cairo
|
||||
curl
|
||||
delve
|
||||
dive
|
||||
drpc.defaultPackage.${system}
|
||||
formatter
|
||||
fzf
|
||||
gcc
|
||||
gdk
|
||||
@ -106,7 +119,7 @@
|
||||
pnpm
|
||||
postgresql_16
|
||||
proto_gen_go_1_30
|
||||
protobuf
|
||||
protobuf_23
|
||||
ripgrep
|
||||
shellcheck
|
||||
(pinnedPkgs.shfmt)
|
||||
@ -114,7 +127,7 @@
|
||||
terraform
|
||||
typos
|
||||
# Needed for many LD system libs!
|
||||
util-linux
|
||||
(lib.optional stdenv.isLinux util-linux)
|
||||
vim
|
||||
wget
|
||||
yq-go
|
||||
@ -129,13 +142,22 @@
|
||||
|
||||
src = ./site/.;
|
||||
# Required for the `canvas` package!
|
||||
extraBuildInputs = with pkgs; [
|
||||
extraBuildInputs =
|
||||
with pkgs;
|
||||
[
|
||||
cairo
|
||||
pango
|
||||
pixman
|
||||
libpng libjpeg giflib librsvg
|
||||
libpng
|
||||
libjpeg
|
||||
giflib
|
||||
librsvg
|
||||
python312Packages.setuptools
|
||||
] ++ ( lib.optionals stdenv.targetPlatform.isDarwin [ darwin.apple_sdk.frameworks.Foundation xcbuild ] );
|
||||
]
|
||||
++ (lib.optionals stdenv.targetPlatform.isDarwin [
|
||||
darwin.apple_sdk.frameworks.Foundation
|
||||
xcbuild
|
||||
]);
|
||||
installInPlace = true;
|
||||
distDir = "out";
|
||||
};
|
||||
@ -144,15 +166,20 @@
|
||||
|
||||
# To make faster subsequent builds, you could extract the `.zst`
|
||||
# slim bundle into it's own derivation.
|
||||
buildFat = osArch:
|
||||
buildFat =
|
||||
osArch:
|
||||
pkgs.buildGo122Module {
|
||||
name = "coder-${osArch}";
|
||||
# Updated with ./scripts/update-flake.sh`.
|
||||
# This should be updated whenever go.mod changes!
|
||||
vendorHash = "sha256-DNQ3UPQoiiWEatMPj6B7QGGy9qOSvOmjADsrr+drCBY=";
|
||||
vendorHash = "sha256-hJBNmHz9ZJLS/QTu8w8y1w/Yi45aSoaSeZ//ysllp6c=";
|
||||
proxyVendor = true;
|
||||
src = ./.;
|
||||
nativeBuildInputs = with pkgs; [ getopt openssl zstd ];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
getopt
|
||||
openssl
|
||||
zstd
|
||||
];
|
||||
preBuild = ''
|
||||
# Replaces /usr/bin/env with an absolute path to the interpreter.
|
||||
patchShebangs ./scripts
|
||||
@ -177,7 +204,9 @@
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
rec {
|
||||
inherit formatter;
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
buildInputs = devShellPackages;
|
||||
@ -186,26 +215,37 @@
|
||||
export PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS=true
|
||||
'';
|
||||
|
||||
LOCALE_ARCHIVE = with pkgs; lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
|
||||
LOCALE_ARCHIVE =
|
||||
with pkgs;
|
||||
lib.optionalDrvAttr stdenv.isLinux "${glibcLocales}/lib/locale/locale-archive";
|
||||
};
|
||||
};
|
||||
|
||||
packages = {
|
||||
packages =
|
||||
{
|
||||
default = packages.${system};
|
||||
|
||||
proto_gen_go = proto_gen_go_1_30;
|
||||
all = pkgs.buildEnv {
|
||||
name = "all-packages";
|
||||
paths = devShellPackages;
|
||||
};
|
||||
site = buildSite;
|
||||
|
||||
# Copying `OS_ARCHES` from the Makefile.
|
||||
linux_amd64 = buildFat "linux_amd64";
|
||||
linux_arm64 = buildFat "linux_arm64";
|
||||
darwin_amd64 = buildFat "darwin_amd64";
|
||||
darwin_arm64 = buildFat "darwin_arm64";
|
||||
windows_amd64 = buildFat "windows_amd64.exe";
|
||||
windows_arm64 = buildFat "windows_arm64.exe";
|
||||
x86_64-linux = buildFat "linux_amd64";
|
||||
aarch64-linux = buildFat "linux_arm64";
|
||||
x86_64-darwin = buildFat "darwin_amd64";
|
||||
aarch64-darwin = buildFat "darwin_arm64";
|
||||
x86_64-windows = buildFat "windows_amd64.exe";
|
||||
aarch64-windows = buildFat "windows_arm64.exe";
|
||||
}
|
||||
// (pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
|
||||
dev_image = pkgs.dockerTools.buildNixShellImage {
|
||||
name = "codercom/oss-dogfood-nix";
|
||||
tag = "latest-${system}";
|
||||
|
||||
drv = devShells.default.overrideAttrs (oldAttrs: {
|
||||
buildInputs = oldAttrs.buildInputs ++ [ pkgs.nix ];
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
VERSION=$1
|
||||
shift 1
|
||||
|
||||
json_print() {
|
||||
echo "{\"@level\":\"error\",\"@message\":\"$*\"}"
|
||||
}
|
||||
# json_print() {
|
||||
# echo "{\"@level\":\"error\",\"@message\":\"$*\"}"
|
||||
# }
|
||||
|
||||
case "$1" in
|
||||
version)
|
||||
|
2
provisionerd/proto/provisionerd.pb.go
generated
2
provisionerd/proto/provisionerd.pb.go
generated
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v4.23.3
|
||||
// protoc v4.23.4
|
||||
// source: provisionerd/proto/provisionerd.proto
|
||||
|
||||
package proto
|
||||
|
2
provisionerd/proto/provisionerd_drpc.pb.go
generated
2
provisionerd/proto/provisionerd_drpc.pb.go
generated
@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||
// protoc-gen-go-drpc version: v0.0.33
|
||||
// protoc-gen-go-drpc version: v0.0.34
|
||||
// source: provisionerd/proto/provisionerd.proto
|
||||
|
||||
package proto
|
||||
|
2
provisionersdk/proto/provisioner.pb.go
generated
2
provisionersdk/proto/provisioner.pb.go
generated
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v4.23.3
|
||||
// protoc v4.23.4
|
||||
// source: provisionersdk/proto/provisioner.proto
|
||||
|
||||
package proto
|
||||
|
2
provisionersdk/proto/provisioner_drpc.pb.go
generated
2
provisionersdk/proto/provisioner_drpc.pb.go
generated
@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||
// protoc-gen-go-drpc version: v0.0.33
|
||||
// protoc-gen-go-drpc version: v0.0.34
|
||||
// source: provisionersdk/proto/provisioner.proto
|
||||
|
||||
package proto
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Updates SRI hashes for flake.nix.
|
||||
|
||||
set -eu
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
|
||||
@ -37,4 +37,6 @@ echo "protoc-gen-go version: $PROTOC_GEN_GO_REV"
|
||||
PROTOC_GEN_GO_SHA256=$(nix-prefetch-git https://github.com/protocolbuffers/protobuf-go --rev "$PROTOC_GEN_GO_REV" | jq -r .hash)
|
||||
sed -i "s#\(sha256 = \"\)[^\"]*#\1${PROTOC_GEN_GO_SHA256}#" ./flake.nix
|
||||
|
||||
make dogfood/contents/nix.hash
|
||||
|
||||
echo "Flake updated successfully!"
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v4.23.3
|
||||
// protoc v4.23.4
|
||||
// source: tailnet/proto/tailnet.proto
|
||||
|
||||
package proto
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
|
||||
// protoc-gen-go-drpc version: v0.0.33
|
||||
// protoc-gen-go-drpc version: v0.0.34
|
||||
// source: tailnet/proto/tailnet.proto
|
||||
|
||||
package proto
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
type MockCoordinatee struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockCoordinateeMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockCoordinateeMockRecorder is the mock recorder for MockCoordinatee.
|
||||
@ -66,15 +67,15 @@ func (mr *MockCoordinateeMockRecorder) SetNodeCallback(arg0 any) *gomock.Call {
|
||||
}
|
||||
|
||||
// SetTunnelDestination mocks base method.
|
||||
func (m *MockCoordinatee) SetTunnelDestination(arg0 uuid.UUID) {
|
||||
func (m *MockCoordinatee) SetTunnelDestination(id uuid.UUID) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetTunnelDestination", arg0)
|
||||
m.ctrl.Call(m, "SetTunnelDestination", id)
|
||||
}
|
||||
|
||||
// SetTunnelDestination indicates an expected call of SetTunnelDestination.
|
||||
func (mr *MockCoordinateeMockRecorder) SetTunnelDestination(arg0 any) *gomock.Call {
|
||||
func (mr *MockCoordinateeMockRecorder) SetTunnelDestination(id any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTunnelDestination", reflect.TypeOf((*MockCoordinatee)(nil).SetTunnelDestination), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTunnelDestination", reflect.TypeOf((*MockCoordinatee)(nil).SetTunnelDestination), id)
|
||||
}
|
||||
|
||||
// UpdatePeers mocks base method.
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
type MockCoordinator struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockCoordinatorMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockCoordinatorMockRecorder is the mock recorder for MockCoordinator.
|
||||
@ -58,42 +59,42 @@ func (mr *MockCoordinatorMockRecorder) Close() *gomock.Call {
|
||||
}
|
||||
|
||||
// Coordinate mocks base method.
|
||||
func (m *MockCoordinator) Coordinate(arg0 context.Context, arg1 uuid.UUID, arg2 string, arg3 tailnet.CoordinateeAuth) (chan<- *proto.CoordinateRequest, <-chan *proto.CoordinateResponse) {
|
||||
func (m *MockCoordinator) Coordinate(ctx context.Context, id uuid.UUID, name string, a tailnet.CoordinateeAuth) (chan<- *proto.CoordinateRequest, <-chan *proto.CoordinateResponse) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Coordinate", arg0, arg1, arg2, arg3)
|
||||
ret := m.ctrl.Call(m, "Coordinate", ctx, id, name, a)
|
||||
ret0, _ := ret[0].(chan<- *proto.CoordinateRequest)
|
||||
ret1, _ := ret[1].(<-chan *proto.CoordinateResponse)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Coordinate indicates an expected call of Coordinate.
|
||||
func (mr *MockCoordinatorMockRecorder) Coordinate(arg0, arg1, arg2, arg3 any) *gomock.Call {
|
||||
func (mr *MockCoordinatorMockRecorder) Coordinate(ctx, id, name, a any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Coordinate", reflect.TypeOf((*MockCoordinator)(nil).Coordinate), arg0, arg1, arg2, arg3)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Coordinate", reflect.TypeOf((*MockCoordinator)(nil).Coordinate), ctx, id, name, a)
|
||||
}
|
||||
|
||||
// Node mocks base method.
|
||||
func (m *MockCoordinator) Node(arg0 uuid.UUID) *tailnet.Node {
|
||||
func (m *MockCoordinator) Node(id uuid.UUID) *tailnet.Node {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Node", arg0)
|
||||
ret := m.ctrl.Call(m, "Node", id)
|
||||
ret0, _ := ret[0].(*tailnet.Node)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Node indicates an expected call of Node.
|
||||
func (mr *MockCoordinatorMockRecorder) Node(arg0 any) *gomock.Call {
|
||||
func (mr *MockCoordinatorMockRecorder) Node(id any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Node", reflect.TypeOf((*MockCoordinator)(nil).Node), arg0)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Node", reflect.TypeOf((*MockCoordinator)(nil).Node), id)
|
||||
}
|
||||
|
||||
// ServeHTTPDebug mocks base method.
|
||||
func (m *MockCoordinator) ServeHTTPDebug(arg0 http.ResponseWriter, arg1 *http.Request) {
|
||||
func (m *MockCoordinator) ServeHTTPDebug(w http.ResponseWriter, r *http.Request) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "ServeHTTPDebug", arg0, arg1)
|
||||
m.ctrl.Call(m, "ServeHTTPDebug", w, r)
|
||||
}
|
||||
|
||||
// ServeHTTPDebug indicates an expected call of ServeHTTPDebug.
|
||||
func (mr *MockCoordinatorMockRecorder) ServeHTTPDebug(arg0, arg1 any) *gomock.Call {
|
||||
func (mr *MockCoordinatorMockRecorder) ServeHTTPDebug(w, r any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServeHTTPDebug", reflect.TypeOf((*MockCoordinator)(nil).ServeHTTPDebug), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServeHTTPDebug", reflect.TypeOf((*MockCoordinator)(nil).ServeHTTPDebug), w, r)
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
type MockSubscription struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockSubscriptionMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockSubscriptionMockRecorder is the mock recorder for MockSubscription.
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
type MockWorkspaceUpdatesProvider struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockWorkspaceUpdatesProviderMockRecorder
|
||||
isgomock struct{}
|
||||
}
|
||||
|
||||
// MockWorkspaceUpdatesProviderMockRecorder is the mock recorder for MockWorkspaceUpdatesProvider.
|
||||
@ -56,16 +57,16 @@ func (mr *MockWorkspaceUpdatesProviderMockRecorder) Close() *gomock.Call {
|
||||
}
|
||||
|
||||
// Subscribe mocks base method.
|
||||
func (m *MockWorkspaceUpdatesProvider) Subscribe(arg0 context.Context, arg1 uuid.UUID) (tailnet.Subscription, error) {
|
||||
func (m *MockWorkspaceUpdatesProvider) Subscribe(ctx context.Context, userID uuid.UUID) (tailnet.Subscription, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Subscribe", arg0, arg1)
|
||||
ret := m.ctrl.Call(m, "Subscribe", ctx, userID)
|
||||
ret0, _ := ret[0].(tailnet.Subscription)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Subscribe indicates an expected call of Subscribe.
|
||||
func (mr *MockWorkspaceUpdatesProviderMockRecorder) Subscribe(arg0, arg1 any) *gomock.Call {
|
||||
func (mr *MockWorkspaceUpdatesProviderMockRecorder) Subscribe(ctx, userID any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subscribe", reflect.TypeOf((*MockWorkspaceUpdatesProvider)(nil).Subscribe), arg0, arg1)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subscribe", reflect.TypeOf((*MockWorkspaceUpdatesProvider)(nil).Subscribe), ctx, userID)
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.30.0
|
||||
// protoc v4.23.3
|
||||
// protoc v4.23.4
|
||||
// source: vpn/vpn.proto
|
||||
|
||||
package vpn
|
||||
|
Reference in New Issue
Block a user