Skip to content

Commit b189134

Browse files
committed
Use NIX for CI
1 parent c47a91e commit b189134

File tree

5 files changed

+120
-13
lines changed

5 files changed

+120
-13
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/pr.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
name: Rust
1+
name: CI
2+
permissions:
3+
contents: read
24

35
on:
46
pull_request:
@@ -14,20 +16,16 @@ jobs:
1416
steps:
1517
- uses: actions/checkout@v4
1618

17-
- name: Install Rust toolchain
18-
uses: dtolnay/rust-toolchain@v1
19+
# Install Nix
20+
- uses: cachix/install-nix-action@v27
1921
with:
20-
toolchain: stable
21-
targets: wasm32-unknown-unknown
22-
components: clippy, rustfmt
22+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
2323

24-
# Install Just to run CI scripts
25-
- uses: extractions/setup-just@v3
24+
# Use our flake to get all development tools (Rust, pnpm, just, cargo tools, etc.)
25+
- run: nix develop --command echo "Development environment ready"
2626

27-
# Cargo binstall is used to install tools faster than compiling them from source.
28-
- uses: cargo-bins/cargo-binstall@main
29-
- run: just setup-tools
27+
# Set RUSTFLAGS
28+
- run: echo "RUSTFLAGS=--cfg=web_sys_unstable_apis" >> $GITHUB_ENV
3029

3130
# Make sure u guys don't write bad code
32-
- run: just check
33-
- run: just test
31+
- run: nix develop --command just check

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
target
22
Cargo.lock
3+
4+
# Node.js
5+
node_modules/
6+
dist/
7+
8+
# Direnv
9+
.direnv/

flake.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
description = "Web Transport development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs =
10+
{
11+
self,
12+
nixpkgs,
13+
flake-utils,
14+
}:
15+
flake-utils.lib.eachDefaultSystem (
16+
system:
17+
let
18+
pkgs = import nixpkgs { inherit system; };
19+
20+
tools = [
21+
pkgs.rustc
22+
pkgs.cargo
23+
pkgs.rustfmt
24+
pkgs.clippy
25+
pkgs.cargo-shear
26+
pkgs.cargo-sort
27+
pkgs.cargo-edit
28+
pkgs.just
29+
pkgs.pkg-config
30+
pkgs.glib
31+
pkgs.gtk3
32+
];
33+
in
34+
{
35+
devShells.default = pkgs.mkShell {
36+
packages = tools;
37+
};
38+
}
39+
);
40+
}

0 commit comments

Comments
 (0)