1
0
Fork 0

default.nix: build zc706

This commit is contained in:
Astro 2019-09-26 17:54:37 +02:00
parent ace24112fa
commit 20249cf2da
2 changed files with 26 additions and 4 deletions

View File

@ -28,6 +28,30 @@ let
rustc = rust // { src = rustcSrc; };
cargo = rust;
});
gcc = pkgsCross.armv7l-hf-multiplatform.buildPackages.gcc;
xbuildRustPackage = attrs:
(rustPlatform.buildRustPackage attrs)
.overrideAttrs (oldAttrs: with oldAttrs; {
nativeBuildInputs =
oldAttrs.nativeBuildInputs ++ [ cargo-xbuild ];
buildPhase = ''
cargo xbuild --release --frozen
'';
XARGO_RUST_SRC = "${rustcSrc}/src";
installPhase = ''
mkdir $out
cp target/armv7-none-eabihf/release/${name} $out/${name}.elf
'';
});
zc706 = xbuildRustPackage {
name = "zc706";
src = ./.;
cargoSha256 = "1n9d8z55cqgpdz4ywyzapbzj7ph7mkfvc87bzyfyyfkx680hz1l9";
nativeBuildInputs = [
gcc
];
doCheck = false;
};
in {
inherit pkgs rustPlatform rustcSrc;
inherit pkgs rustPlatform rustcSrc zc706 gcc;
}

View File

@ -12,9 +12,7 @@ stdenv.mkDerivation {
buildInputs = (with rustPlatform.rust; [
rustc cargo
cargo-xbuild rustcSrc
# pkgsCross.armhf-embedded.buildPackages.gcc
pkgsCross.armv7l-hf-multiplatform.buildPackages.gcc
#pkgsCross.armhf-embedded.buildPackages.binutils
gcc
]) ++ (with pkgs; [ openocd gdb ]);
# Set Environment Variables