Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 9f29cc6

Browse files
committed
Add nix flake and CI
1 parent 31f9e45 commit 9f29cc6

File tree

4 files changed

+158
-0
lines changed

4 files changed

+158
-0
lines changed

.envrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
use_flake() {
2+
watch_file flake.nix
3+
watch_file flake.lock
4+
eval "$(nix print-dev-env)"
5+
}
6+
use flake

.github/workflows/nix.yml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: "Nix CI"
2+
on:
3+
pull_request:
4+
push:
5+
jobs:
6+
tests:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/[email protected]
10+
- uses: cachix/install-nix-action@v13
11+
with:
12+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
13+
install_options: '--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve'
14+
extra_nix_config: |
15+
experimental-features = nix-command flakes
16+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
17+
- uses: cachix/cachix-action@v10
18+
with:
19+
name: yatima
20+
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
21+
- run: nix build
22+
- run: nix flake check

flake.lock

+93
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
inputs = {
3+
utils.url = "github:yatima-inc/nix-utils";
4+
};
5+
6+
outputs =
7+
{ self
8+
, utils
9+
}:
10+
utils.inputs.flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
lib = utils.lib.${system};
13+
pkgs = utils.nixpkgs.${system};
14+
inherit (lib) buildRustProject testRustProject rustDefault filterRustProject;
15+
rust = rustDefault;
16+
crateName = "sp-ipld";
17+
root = ./.;
18+
in
19+
{
20+
packages.${crateName} = buildRustProject { inherit root; };
21+
22+
checks.${crateName} = testRustProject { doCheck = true; inherit root; cargoTestOptions = options: options ++ [ "--all-features" ]; };
23+
24+
defaultPackage = self.packages.${system}.${crateName};
25+
26+
# `nix develop`
27+
devShell = pkgs.mkShell {
28+
inputsFrom = builtins.attrValues self.packages.${system};
29+
nativeBuildInputs = [ rust ];
30+
buildInputs = with pkgs; [
31+
rust-analyzer
32+
clippy
33+
rustfmt
34+
];
35+
};
36+
});
37+
}

0 commit comments

Comments
 (0)