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; }; rustc = rust // { src = rustcSrc; };
cargo = rust; 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 { in {
inherit pkgs rustPlatform rustcSrc; inherit pkgs rustPlatform rustcSrc zc706 gcc;
} }

View File

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