Skip to content

Commit 2ec58b6

Browse files
Anderssorbysamuelburnham
authored andcommitted
Fix nix flake check
1 parent 950ce11 commit 2ec58b6

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
lines changed

.github/workflows/nix.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@ on:
44
push:
55
branches:
66
- main
7+
- master
78
jobs:
89
tests:
910
runs-on: ubuntu-latest
11+
env:
12+
NIX_BUILD_ARGS: -v --print-build-logs --fallback --show-trace
1013
steps:
1114
- uses: actions/checkout@v2.3.4
1215
- uses: cachix/install-nix-action@v13
@@ -20,5 +23,9 @@ jobs:
2023
with:
2124
name: yatima
2225
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
23-
- run: nix build
24-
- run: nix flake check
26+
- name: Nix build
27+
run: nix build $NIX_BUILD_ARGS
28+
- name: Nix check
29+
run: nix flake check $NIX_BUILD_ARGS
30+
- name: Nix shell
31+
run: nix shell $NIX_BUILD_ARGS --command echo OK

flake.lock

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

flake.nix

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,14 @@
66
url = github:numtide/flake-utils;
77
inputs.nixpkgs.follows = "nixpkgs";
88
};
9+
naersk = {
10+
url = github:yatima-inc/naersk;
11+
inputs.nixpkgs.follows = "nixpkgs";
12+
};
913
utils = {
1014
url = github:yatima-inc/nix-utils;
1115
inputs.nixpkgs.follows = "nixpkgs";
16+
inputs.naersk.follows = "naersk";
1217
};
1318
};
1419

@@ -17,20 +22,33 @@
1722
, nixpkgs
1823
, flake-utils
1924
, utils
25+
, naersk
2026
}:
21-
flake-utils.lib.eachDefaultSystem (system:
27+
let
28+
# Only use the supported systems
29+
supportedSystems = builtins.attrNames naersk.lib;
30+
in
31+
flake-utils.lib.eachSystem supportedSystems (system:
2232
let
2333
lib = utils.lib.${system};
2434
pkgs = import nixpkgs { inherit system; };
25-
inherit (lib) buildRustProject testRustProject rustDefault filterRustProject;
26-
rust = rustDefault;
35+
inherit (lib) buildRustProject testRustProject getRust;
36+
rustNightly = getRust { date = "2021-10-13"; sha256 = "2hYUzd1vkONFeibPF2ZVOWR5LhKGecA0+Dq4/fTyNMg="; };
2737
crateName = "rust-multihash";
2838
root = ./.;
29-
project = buildRustProject { inherit root; };
39+
project = buildRustProject { inherit root; rust = rustNightly; };
3040
in
3141
{
3242
packages.${crateName} = project;
33-
checks.${crateName} = testRustProject { doCheck = true; inherit root; };
43+
checks.${crateName} = testRustProject {
44+
inherit root;
45+
rust = rustNightly;
46+
# Avoid unstable_options in test
47+
cargoOptions = opt: [];
48+
cargoBuildOptions = opt: [ "-Z unstable-options" ] ++ opt;
49+
cargoTestOptions = opt: [ "--all-features" ] ++ opt;
50+
51+
};
3452

3553
defaultPackage = self.packages.${system}.${crateName};
3654

@@ -42,7 +60,7 @@
4260
# `nix develop`
4361
devShell = pkgs.mkShell {
4462
inputsFrom = builtins.attrValues self.packages.${system};
45-
nativeBuildInputs = [ rust ];
63+
nativeBuildInputs = [ rustNightly ];
4664
buildInputs = with pkgs; [
4765
rust-analyzer
4866
clippy

0 commit comments

Comments
 (0)