2019-05-05 20:56:23 +08:00
|
|
|
let
|
2020-09-09 16:51:50 +08:00
|
|
|
pkgs = import <nixpkgs> { overlays = [ (import ./nix/mozilla-overlay.nix) ]; };
|
|
|
|
rustPlatform = (import ./nix/rust-platform.nix { inherit pkgs; });
|
|
|
|
build-crate = name: crate: features:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
name = "${crate}";
|
|
|
|
|
|
|
|
src = ./.;
|
2020-09-09 17:56:50 +08:00
|
|
|
cargoSha256 = "1f2psa1g41pl2j8n60hhik2s2pqdfjhr5capimvajf81kxrnn2ck";
|
2020-09-09 16:51:50 +08:00
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgs.cargo-xbuild ];
|
2019-09-26 23:54:37 +08:00
|
|
|
buildPhase = ''
|
2020-10-13 18:27:01 +08:00
|
|
|
export XARGO_RUST_SRC="${rustPlatform.rust.rustc.src}/library"
|
2020-09-09 16:51:50 +08:00
|
|
|
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
|
|
|
pushd ${crate}
|
2020-01-26 08:45:02 +08:00
|
|
|
cargo xbuild --release --frozen \
|
|
|
|
--no-default-features \
|
2020-09-09 16:51:50 +08:00
|
|
|
--features=${features}
|
2020-01-26 08:45:02 +08:00
|
|
|
popd
|
2019-09-26 23:54:37 +08:00
|
|
|
'';
|
2020-09-09 16:51:50 +08:00
|
|
|
|
2019-09-26 23:54:37 +08:00
|
|
|
installPhase = ''
|
2020-09-09 16:51:50 +08:00
|
|
|
mkdir -p $out $out/nix-support
|
2019-09-26 23:54:37 +08:00
|
|
|
cp target/armv7-none-eabihf/release/${name} $out/${name}.elf
|
2020-09-09 16:51:50 +08:00
|
|
|
echo file binary-dist $out/${name}.elf >> $out/nix-support/hydra-build-products
|
2019-09-26 23:54:37 +08:00
|
|
|
'';
|
2020-09-09 16:51:50 +08:00
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
dontFixup = true;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2020-09-09 17:12:08 +08:00
|
|
|
zc706-experiments = build-crate "zc706-experiments" "experiments" "target_zc706";
|
|
|
|
cora-experiments = build-crate "cora-experiments" "experiments" "target_cora_z7_10";
|
2020-09-09 21:28:32 +08:00
|
|
|
redpitaya-experiments = build-crate "redpitaya-experiments" "experiments" "target_redpitaya";
|
2020-09-09 17:12:08 +08:00
|
|
|
zc706-fsbl = (import ./nix/fsbl.nix { inherit pkgs; });
|
2020-09-09 17:56:50 +08:00
|
|
|
zc706-szl = build-crate "zc706-szl" "szl" "target_zc706";
|
2020-09-09 16:51:50 +08:00
|
|
|
}
|