+73
-4
Diff
round #1
+35
.buildkite/hooks/pre-command
+35
.buildkite/hooks/pre-command
···
1
+
#!/bin/sh
2
+
#
3
+
# Buildkite pre-command hook: install Determinate Nix on the agent
4
+
# before each command step runs. We rely on Nix (with flakes) for our
5
+
# build environment, so every fresh agent needs it bootstrapped.
6
+
#
7
+
# Determinate's installer enables flakes and `nix-command` by default
8
+
# and is more reliable in CI than the upstream installer, so we don't
9
+
# need to stage a custom nix.conf.
10
+
11
+
set -eu
12
+
13
+
# Install Nix without touching the agent's init system. The `?ci=buildkite`
14
+
# query param is informational; it lets Determinate tag installer telemetry.
15
+
curl --proto '=https' --tlsv1.2 -sSf -L \
16
+
"https://install.determinate.systems/nix?ci=buildkite" \
17
+
| sh -s -- install linux --no-confirm --init none
18
+
19
+
# Start the Determinate daemon ourselves since we passed `--init none`.
20
+
# Point the Nix client at the daemon for the rest of this shell.
21
+
nohup /usr/local/bin/determinate-nixd daemon &
22
+
export NIX_REMOTE=daemon
23
+
24
+
# Wait for the daemon to become responsive before handing control back
25
+
# to the command step.
26
+
while ! determinate-nixd status >/dev/null 2>&1; do
27
+
sleep 0.1
28
+
done
29
+
30
+
# Put `nix` on PATH for the command step. Buildkite sources hooks, so
31
+
# this export propagates. With `--init none` we never edited any shell
32
+
# profile, so we have to do it ourselves. The default profile holds the
33
+
# `nix` binary; the per-user profile holds anything `nix profile install`
34
+
# adds later.
35
+
export PATH="/nix/var/nix/profiles/default/bin:$HOME/.nix-profile/bin:$PATH"
+18
.buildkite/pipeline.yml
+18
.buildkite/pipeline.yml
···
1
+
# In-repo Buildkite pipeline. The Buildkite-side pipeline only needs
2
+
# one step that does `buildkite-agent pipeline upload`; everything
3
+
# real lives here.
4
+
5
+
steps:
6
+
- label: ":nix: format check"
7
+
# `nix fmt` dispatches to the flake's `formatter` output (alejandra).
8
+
# `--` forwards `--check` to alejandra, which exits non-zero on any
9
+
# file that would be reformatted so the build fails instead of
10
+
# silently rewriting files.
11
+
command: nix fmt -- --check .
12
+
13
+
- label: ":go: test"
14
+
# Run the full Go test suite inside the flake's dev shell so the
15
+
# toolchain (go, cgo deps for mattn/go-sqlite3) matches what the
16
+
# package build uses. `nix develop -c` runs the given command in the
17
+
# default devShell without dropping into an interactive shell.
18
+
command: nix develop -c go test ./...
+12
.tangled/workflows/test.yml
+12
.tangled/workflows/test.yml
+6
-2
flake.nix
+6
-2
flake.nix
···
12
12
flake-utils,
13
13
...
14
14
}:
15
-
# Per-system outputs (packages, apps, devShells). nixosModules is
16
-
# system-independent and is merged in below.
15
+
# Per-system outputs (packages, apps, devShells). nixosModules is
16
+
# system-independent and is merged in below.
17
17
flake-utils.lib.eachDefaultSystem (
18
18
system: let
19
19
pkgs = nixpkgs.legacyPackages.${system};
···
39
39
env.CGO_ENABLED = "1";
40
40
};
41
41
in {
42
+
# `nix fmt` formats the tree with alejandra. CI pins this same
43
+
# binary via `nix run nixpkgs#alejandra` for the format check.
44
+
formatter = pkgs.alejandra;
45
+
42
46
devShells.default = pkgs.mkShell {
43
47
packages = [
44
48
pkgs.go
+2
-2
nix/modules/tack.nix
+2
-2
nix/modules/tack.nix
···
1
-
# NixOS module for the tack spindle.
1
+
# NixOS module for the tack spindle.
2
2
{
3
3
config,
4
4
lib,
···
127
127
]
128
128
++ optional cfg.dev "TACK_DEV=1"
129
129
++ optional (cfg.buildkite.org != null)
130
-
"TACK_BUILDKITE_ORG=${cfg.buildkite.org}";
130
+
"TACK_BUILDKITE_ORG=${cfg.buildkite.org}";
131
131
132
132
ExecStart = "${cfg.package}/bin/tack -addr ${cfg.listenAddr}";
133
133
Restart = "always";
History
3 rounds
0 comments
mitchellh.com
submitted
#2
1 commit
expand
collapse
configure buildkite
merge conflicts detected
expand
collapse
expand
collapse
- flake.nix:12
- nix/modules/tack.nix:1
expand 0 comments
mitchellh.com
submitted
#1
1 commit
expand
collapse
configure buildkite
expand 0 comments
mitchellh.com
submitted
#0
1 commit
expand
collapse
configure buildkite