Commit 3ab04e0d authored by Florian Franzen's avatar Florian Franzen
Browse files

flake: add naersk build tool

parent d010de4d
......@@ -16,6 +16,26 @@
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1614785451,
"narHash": "sha256-TPw8kQvr2UNCuvndtY+EjyXp6Q5GEW2l9UafXXh1XmI=",
"owner": "nmattia",
"repo": "naersk",
"rev": "e0fe990b478a66178a58c69cf53daec0478ca6f9",
"type": "github"
},
"original": {
"owner": "nmattia",
"repo": "naersk",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1615879109,
......@@ -51,6 +71,7 @@
"root": {
"inputs": {
"mozilla": "mozilla",
"naersk": "naersk",
"nixpkgs": "nixpkgs",
"polkadot-spec": "polkadot-spec",
"utils": "utils"
......
......@@ -11,11 +11,17 @@
# Overlay used for nightly rust support
mozilla = { url = "github:mozilla/nixpkgs-mozilla"; flake = false; };
# Rust build tool
naersk = {
url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
# Polkadot specification and testsuite repo
polkadot-spec = { url = "github:w3f/polkadot-spec"; flake = false; };
};
outputs = { self, utils, nixpkgs, ... } @ sources :
outputs = { self, utils, nixpkgs, naersk, ... } @ sources :
utils.lib.eachDefaultSystem (system:
let
rust-overlay = import "${sources.mozilla}/rust-overlay.nix";
......@@ -24,6 +30,7 @@
inherit system;
overlays = [
self.overlay
naersk.overlay
rust-overlay
];
};
......
......@@ -8,7 +8,19 @@ let
# Support derivations and environments used during build
support = with final; {
# Nigthly rust with rust-std for wasm target
rustWasmPlatform = callPackage ./support/rust.nix {};
rustWasm = callPackage ./support/rustWasm.nix {};
# Platform with nightly wasm rust
rustWasmPlatform = makeRustPlatform {
rustc = rustWasm;
cargo = rustWasm;
};
# Naersk with nightly and rust
naerskWasm = naersk.override {
rustc = rustWasm;
cargo = rustWasm;
};
};
# Dependency derivations (buildable)
......
......@@ -6,9 +6,5 @@ let
channel = "nightly";
sha256 = "16r5lldank00c2bhnrzr1bxfsbvqxzcap5zmh40ri46x0jfbx8jh";
};
rust_wasm = channel.rust.override { targets = [ "wasm32-unknown-unknown" ]; };
in
makeRustPlatform {
rustc = rust_wasm;
cargo = rust_wasm;
}
in
channel.rust.override { targets = [ "wasm32-unknown-unknown" ]; }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment