2019-03-19 06:09:54 +08:00
|
|
|
{ stdenv, rustPlatform, cacert, git, cargo-vendor }:
|
2019-03-07 23:27:33 +08:00
|
|
|
|
|
|
|
with rustPlatform;
|
2019-03-19 06:09:54 +08:00
|
|
|
let
|
2019-03-25 08:33:45 +08:00
|
|
|
sha256 = "0071fn2gj976s20nv6wfjyi0ddcsq17sbpdxkfl0r5hwia5gixph";
|
2019-03-19 06:09:54 +08:00
|
|
|
fetchcargo = import ./fetchcargo.nix {
|
|
|
|
inherit stdenv cacert git cargo-vendor;
|
|
|
|
inherit (rust) cargo;
|
|
|
|
};
|
|
|
|
adc2tcpDeps = fetchcargo {
|
|
|
|
name = "adc2tcp-deps";
|
|
|
|
src = ../.;
|
2019-03-25 08:33:45 +08:00
|
|
|
inherit sha256;
|
2019-03-19 06:09:54 +08:00
|
|
|
};
|
|
|
|
in
|
2019-03-07 23:27:33 +08:00
|
|
|
|
|
|
|
buildRustPackage rec {
|
|
|
|
name = "adc2tcp";
|
|
|
|
version = "0.0.0";
|
|
|
|
|
|
|
|
src = ../.;
|
2019-03-25 08:33:45 +08:00
|
|
|
cargoSha256 = sha256;
|
2019-03-19 06:09:54 +08:00
|
|
|
|
|
|
|
buildInputs = [ adc2tcpDeps ];
|
|
|
|
patchPhase = ''
|
|
|
|
cat >> .cargo/config <<EOF
|
|
|
|
[source.crates-io]
|
|
|
|
replace-with = "vendored-sources"
|
|
|
|
|
|
|
|
[source.vendored-sources]
|
|
|
|
directory = "${adc2tcpDeps}"
|
|
|
|
|
|
|
|
[source."https://github.com/stm32-rs/stm32f4xx-hal"]
|
|
|
|
git = "https://github.com/stm32-rs/stm32f4xx-hal"
|
|
|
|
branch = "master"
|
|
|
|
replace-with = "vendored-sources"
|
|
|
|
|
|
|
|
[source."https://github.com/stm32-rs/stm32-eth"]
|
|
|
|
git = "https://github.com/stm32-rs/stm32-eth"
|
|
|
|
branch = "master"
|
|
|
|
replace-with = "vendored-sources"
|
|
|
|
EOF
|
|
|
|
'';
|
2019-03-07 23:27:33 +08:00
|
|
|
|
|
|
|
doCheck = false;
|
2019-03-08 01:24:21 +08:00
|
|
|
installPhase = ''
|
2019-03-25 01:44:36 +08:00
|
|
|
mkdir -p $out/lib
|
2019-03-08 01:24:21 +08:00
|
|
|
cp target/thumbv7em-none-eabihf/release/adc2tcp $out/lib/
|
|
|
|
'';
|
2019-03-07 23:27:33 +08:00
|
|
|
}
|