Skip to content

Commit bf7b19b

Browse files
authored
Use NIX for CI (#113)
* Use NIX for CI * Add cargo hack * PR
1 parent c47a91e commit bf7b19b

File tree

5 files changed

+113
-14
lines changed

5 files changed

+113
-14
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: 9 additions & 14 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,13 @@ 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
26-
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
24+
# Set RUSTFLAGS
25+
- run: echo "RUSTFLAGS=--cfg=web_sys_unstable_apis" >> $GITHUB_ENV
3026

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
target
22
Cargo.lock
3+
.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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.cargo-hack
29+
pkgs.just
30+
pkgs.pkg-config
31+
pkgs.glib
32+
pkgs.gtk3
33+
];
34+
in
35+
{
36+
devShells.default = pkgs.mkShell {
37+
packages = tools;
38+
};
39+
}
40+
);
41+
}

0 commit comments

Comments
 (0)