Initial commit
This commit is contained in:
commit
e483f73dd4
12 changed files with 479 additions and 0 deletions
51
examples/fenix/flake.nix
Normal file
51
examples/fenix/flake.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
description = "An example of a shell environment with a Fenix toolchain";
|
||||
|
||||
inputs = {
|
||||
rust.url = "git+https://forgejo.alt0r.com/braunse/rust-part";
|
||||
nixpkgs.follows = "rust/nixpkgs";
|
||||
parts.follows = "rust/parts";
|
||||
rustManifest.follows = "rust/rustManifest";
|
||||
};
|
||||
|
||||
outputs = inputs: inputs.parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [ inputs.rust.flakeModules.fenix ];
|
||||
|
||||
systems = [ "x86_64-linux" ];
|
||||
|
||||
rust.fenix.manifestFile = inputs.rustManifest;
|
||||
rust.fenix.components = [ "rustfmt" ];
|
||||
rust.fenix.targetComponents.wasm32-unknown-unknown = [ "rust-std" ];
|
||||
|
||||
perSystem =
|
||||
{ pkgs, fenixToolchain, ... }: {
|
||||
checks = {
|
||||
haveRustChain = pkgs.stdenv.mkDerivation {
|
||||
name = "check-rust-toolchain-is-present";
|
||||
dontUnpack = true;
|
||||
buildPhase = ''
|
||||
set -euo pipefail
|
||||
|
||||
echo "Checking for cargo" >&2
|
||||
${fenixToolchain}/bin/cargo --version >/dev/null
|
||||
|
||||
echo "Checking for rustc" >&2
|
||||
${fenixToolchain}/bin/rustc --version >/dev/null
|
||||
|
||||
echo "Checking for rustfmt" >&2
|
||||
${fenixToolchain}/bin/rustfmt --version >/dev/null
|
||||
|
||||
echo "Checking compiler compiles natively" >&2
|
||||
touch lib.rs
|
||||
${fenixToolchain}/bin/rustc --crate-type rlib --crate-name nativechecklib lib.rs
|
||||
|
||||
echo "Checking compiler compiles for wasm32-unknown-unknown" >&2
|
||||
${fenixToolchain}/bin/rustc --crate-type rlib --crate-name crosschecklib --target wasm32-unknown-unknown lib.rs
|
||||
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue