forked from maelstrom-software/maelstrom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
60 lines (49 loc) · 1.71 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{
description = "Maelstrom is an extremely fast Rust test runner built on top of a general-purpose clustered job runner.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
flake-utils.inputs.systems.follows = "systems";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs:
let
inherit (inputs) self nixpkgs rust-overlay;
inherit (inputs.crane) mkLib;
inherit (inputs.flake-utils.lib) eachDefaultSystem;
inherit (inputs.nixpkgs.lib) genAttrs importTOML;
cargoToml = importTOML ./Cargo.toml;
thisNixpkgs = genAttrs (import inputs.systems) (
system:
import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
}
);
inherit (cargoToml.workspace.package) rust-version version;
in
eachDefaultSystem (
system:
let
pkgs = thisNixpkgs.${system};
# Use the Rust toolchain from Cargo.toml
rustToolchain = pkgs.rust-bin.stable.${rust-version}.default.override {
extensions = [ "rust-src" ];
targets = [ "wasm32-unknown-unknown" ];
};
craneLib = ((mkLib pkgs).overrideToolchain rustToolchain);
in
{
packages.default = pkgs.callPackage ./package.nix { inherit craneLib version; };
devShells.default = pkgs.callPackage ./shell.nix {
inherit craneLib;
maelstrom = self.packages.${system}.default;
};
}
);
}