Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Commit 7e85486

Browse files
committed
ci: use nix devshell for CI operations
Install all dependencies and tools using a nix devshell to make troublshooting any difficulties more easy to reproduce in places other than Github.
1 parent c23f85d commit 7e85486

File tree

8 files changed

+39
-49
lines changed

8 files changed

+39
-49
lines changed

.github/workflows/_lint.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@ jobs:
1111
- name: Check out code
1212
uses: actions/checkout@v4
1313

14-
- name: Setup Rust
15-
run: |
16-
sudo apt-get update
17-
sudo apt-get install -y build-essential
18-
sudo snap install --classic rustup
19-
rustup default stable
14+
- name: Install nix
15+
uses: DeterminateSystems/nix-installer-action@v16
2016

2117
- name: Check formattting
22-
run: cargo fmt --check
18+
run: nix develop -c cargo fmt --check
2319

2420
- name: Lint
25-
run: cargo clippy
21+
run: nix develop -c cargo clippy

.github/workflows/_spread-matrix.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919

20-
- name: Setup Go
21-
uses: actions/setup-go@v5
22-
23-
- name: Install
24-
run: |
25-
go install github.com/snapcore/spread/cmd/spread@latest
20+
- name: Install nix
21+
uses: DeterminateSystems/nix-installer-action@v16
2622

2723
- name: Generate matrix list
2824
id: tests
2925
run: |
30-
list="$(spread -list lxd | jq -r -ncR '[inputs | select(length>0)]')"
26+
list="$(nix develop -c spread -list lxd | jq -r -ncR '[inputs | select(length>0)]')"
3127
echo "tests=$list"
3228
echo "tests=$list" >> "$GITHUB_OUTPUT"

.github/workflows/_spread.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@ jobs:
2020
- name: Checkout
2121
uses: actions/checkout@v4
2222

23-
- name: Setup Go
24-
uses: actions/setup-go@v5
25-
with:
26-
go-version: "1.23.0"
27-
28-
- name: Install
29-
run: go install github.com/snapcore/spread/cmd/spread@latest
23+
- name: Install nix
24+
uses: DeterminateSystems/nix-installer-action@v16
3025

3126
- name: Setup LXD
3227
uses: canonical/[email protected]
3328

3429
- name: Run integration tests
35-
run: spread -v "${{ matrix.test }}"
30+
run: nix develop -c spread -v "${{ matrix.test }}"

.github/workflows/_test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@ jobs:
1111
- name: Check out code
1212
uses: actions/checkout@v4
1313

14-
- name: Setup Rust
15-
run: |
16-
sudo apt-get update
17-
sudo apt-get install -y build-essential
18-
sudo snap install --classic rustup
19-
rustup default stable
14+
- name: Install nix
15+
uses: DeterminateSystems/nix-installer-action@v16
2016

2117
- name: Build
22-
run: cargo build
18+
run: nix develop -c cargo build
2319

2420
- name: Unit tests
25-
run: cargo test -- --show-output
21+
run: nix develop -c cargo test -- --show-output

.github/workflows/push.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,13 @@ jobs:
3232
with:
3333
fetch-depth: 0
3434

35-
- name: Setup goreleaser
36-
run: |
37-
sudo snap install --classic goreleaser
35+
- name: Install nix
36+
uses: DeterminateSystems/nix-installer-action@v16
3837

3938
- name: Build oxidizr
4039
id: build
4140
run: |
42-
goreleaser build --snapshot --clean --verbose
41+
nix develop -c goreleaser build --snapshot --clean --verbose
4342
4443
spread-tests:
4544
name: Spread tests

.github/workflows/release.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,12 @@ jobs:
4343
with:
4444
fetch-depth: 0
4545

46-
- name: Setup goreleaser
47-
run: |
48-
sudo snap install --classic goreleaser
46+
- name: Install nix
47+
uses: DeterminateSystems/nix-installer-action@v16
4948

5049
- name: Release oxidizr
5150
id: build
5251
run: |
53-
goreleaser release --clean --verbose
52+
nix develop -c goreleaser release --clean --verbose
5453
env:
5554
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ project_name: oxidizr
33
before:
44
hooks:
55
- rustup default stable
6-
- cargo install cross --git https://github.com/cross-rs/cross
76

87
builds:
98
- builder: rust
@@ -14,7 +13,8 @@ builds:
1413
command: build
1514

1615
archives:
17-
- format: tar.gz
16+
- formats:
17+
- tar.gz
1818
name_template: >-
1919
{{ .ProjectName }}_
2020
{{- title .Os }}_

flake.nix

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{
1111
self,
1212
nixpkgs,
13-
rust-overlay,
13+
...
1414
}:
1515
let
1616
supportedSystems = [
@@ -23,7 +23,7 @@
2323
system:
2424
(import nixpkgs {
2525
inherit system;
26-
overlays = [ (import rust-overlay) ];
26+
overlays = [ self.inputs.rust-overlay.overlays.default ];
2727
});
2828
in
2929
{
@@ -64,7 +64,12 @@
6464
let
6565
pkgs = pkgsForSystem system;
6666
rust = pkgs.rust-bin.stable.latest.default.override {
67-
extensions = [ "rust-src" ];
67+
extensions = [
68+
"rust-src"
69+
"clippy"
70+
"rust-analyzer"
71+
"rustfmt"
72+
];
6873
};
6974
in
7075
{
@@ -74,11 +79,15 @@
7479
NIX_CONFIG = "experimental-features = nix-command flakes";
7580
RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library";
7681

77-
inputsFrom = [ self.packages.${system}.oxidizr ];
78-
buildInputs = with pkgs; [
79-
clippy
80-
rust
81-
];
82+
buildInputs =
83+
(with pkgs; [
84+
cargo-cross
85+
rustup
86+
spread
87+
goreleaser
88+
jq
89+
])
90+
++ [ rust ];
8291
};
8392
}
8493
);

0 commit comments

Comments
 (0)