forked from M-Labs/nix-scripts
Compare commits
1 Commits
master
...
stm32-no-o
Author | SHA1 | Date | |
---|---|---|---|
7345020cf1 |
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,18 @@
|
|||||||
{ # Use master branch of the overlay by default
|
{ pkgs ? import (builtins.fetchGit { url = git://github.com/NixOS/nixpkgs-channels; }) {},
|
||||||
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"
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
let
|
let
|
||||||
pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
|
rust-thumb-crates = callPackage ./rust-thumb-crates.nix { inherit (rustPlatform.rust) rustc; };
|
||||||
rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix {
|
llvm-rust-src = fetchFromGitHub {
|
||||||
inherit rustManifest;
|
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 }:
|
buildStm32Firmware = { name, src, cargoSha256 }:
|
||||||
rustPlatform.buildRustPackage rec {
|
rustPlatform.buildRustPackage rec {
|
||||||
inherit name;
|
inherit name;
|
||||||
@ -15,10 +20,14 @@ let
|
|||||||
|
|
||||||
inherit src cargoSha256;
|
inherit src cargoSha256;
|
||||||
|
|
||||||
|
buildInputs = [ lld ];
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
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;
|
doCheck = false;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
@ -37,6 +46,6 @@ in
|
|||||||
thermostat = buildStm32Firmware {
|
thermostat = buildStm32Firmware {
|
||||||
name = "thermostat";
|
name = "thermostat";
|
||||||
src = <thermostatSrc>;
|
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
Block a user