forked from M-Labs/nix-scripts
stm32: remove the mozilla overlay, build with rust 1.32.4-stable
resulting binaries lack important sections.
This commit is contained in:
parent
eee00cea64
commit
7345020cf1
File diff suppressed because it is too large
Load Diff
|
@ -1,13 +1,18 @@
|
|||
{ # Use master branch of the overlay by default
|
||||
mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz),
|
||||
rustManifest ? builtins.fetchurl "https://static.rust-lang.org/dist/channel-rust-nightly.toml"
|
||||
{ pkgs ? import (builtins.fetchGit { url = git://github.com/NixOS/nixpkgs-channels; }) {},
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
let
|
||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix {
|
||||
inherit rustManifest;
|
||||
});
|
||||
rust-thumb-crates = callPackage ./rust-thumb-crates.nix { inherit (rustPlatform.rust) rustc; };
|
||||
llvm-rust-src = fetchFromGitHub {
|
||||
owner = "rust-lang";
|
||||
repo = "llvm-project";
|
||||
rev = "rustc/8.0-2019-03-18";
|
||||
sha256 = "0lvlf76yyjk61wl1y6l83w84g8y06vz4mwjcxwxcgdmh480ha8vb";
|
||||
};
|
||||
lld = llvmPackages_8.lld.override {
|
||||
fetch = name: _sha256: builtins.toPath "${llvm-rust-src}/${name}";
|
||||
};
|
||||
buildStm32Firmware = { name, src, cargoSha256 }:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
inherit name;
|
||||
|
@ -15,10 +20,14 @@ let
|
|||
|
||||
inherit src cargoSha256;
|
||||
|
||||
buildInputs = [ lld ];
|
||||
buildPhase = ''
|
||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||
cargo build --release
|
||||
export RUSTFLAGS="-L ${rust-thumb-crates}/lib/rustlib/thumbv7em-none-eabihf/lib -C linker-flavor=ld.lld -C linker=lld"
|
||||
cargo build --release -v -v
|
||||
'';
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
|
||||
doCheck = false;
|
||||
installPhase = ''
|
||||
|
@ -37,6 +46,6 @@ in
|
|||
thermostat = buildStm32Firmware {
|
||||
name = "thermostat";
|
||||
src = <thermostatSrc>;
|
||||
cargoSha256 = "1i9p5d5n01ajbp8lmavyway6vr1mmy107qnccff9glvr91rqx352";
|
||||
cargoSha256 = "1xbnd2j4akdf3fc62frb74vpghspkr58kbya2gyzqqdj2gfzy8dh";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
{ recurseIntoAttrs, stdenv, lib,
|
||||
makeRustPlatform,
|
||||
fetchurl, patchelf,
|
||||
rustManifest ? ./channel-rust-nightly.toml
|
||||
}:
|
||||
|
||||
let
|
||||
targets = [
|
||||
"thumbv7em-none-eabihf"
|
||||
];
|
||||
rustChannel =
|
||||
lib.rustLib.fromManifestFile rustManifest {
|
||||
inherit stdenv fetchurl patchelf;
|
||||
};
|
||||
rust =
|
||||
rustChannel.rust.override {
|
||||
inherit targets;
|
||||
};
|
||||
in
|
||||
makeRustPlatform {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
}
|
Loading…
Reference in New Issue