Browse Source

default.nix: build zc706

master
Astro 5 months ago
parent
commit
20249cf2da
2 changed files with 26 additions and 4 deletions
  1. 25
    1
      default.nix
  2. 1
    3
      shell.nix

+ 25
- 1
default.nix 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;
}

+ 1
- 3
shell.nix 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

Loading…
Cancel
Save