This repository has been archived by the owner on Sep 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
flake.nix
85 lines (73 loc) · 2.37 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{
description = "W3F Polkadot Protocol Testsuite";
inputs = {
# Local git submodules (needs manual update)
gossamer-submodule = {
url = "git+file:./hosts/gossamer";
flake = false;
};
kagome-submodule = {
url = "git+file:./hosts/kagome";
flake = false;
};
substrate-submodule = {
url = "git+file:./hosts/substrate";
flake = false;
};
# Nix utils libraries
utils.url = "github:numtide/flake-utils";
# Rust toolchain parsing and build tools
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, utils, nixpkgs, fenix, naersk, ... } @ inputs:
utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
let
# Provide commen shorthands
pkgs = nixpkgs.legacyPackages.${system};
# Intialize rust toolchain based on toolchain file
rustToolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "R6uGJG/aH25t3CEXyD28m4b7HRYvjtCqzRtfBqIFfi4=";
};
naerskToolchain = naersk.lib.${system}.override {
rustc = rustToolchain;
cargo = rustToolchain;
};
# Intialize package set
submodules = {
inherit (inputs) gossamer-submodule kagome-submodule substrate-submodule;
};
packages = import ./.nix/packages.nix {
inherit self pkgs submodules;
naersk = naerskToolchain;
};
in {
devShells = {
# Shell including all required dependecies
default = pkgs.mkShell {
inputsFrom = builtins.attrValues self.packages.${system};
buildInputs = [ pkgs.gnumake ];
};
# General shell for substrate-based development
substrate = pkgs.callPackage ./.nix/substrate/env.nix {
inherit rustToolchain;
};
};
# All testsuite related binaries and testsuite itself
packages = packages.hosts // packages.testsuite // {
inherit rustToolchain;
default = packages.polkadot-testsuite;
};
}
) // {
# We currently only check on x86_64-linux
checks.x86_64-linux = self.packages.x86_64-linux;
};
}