forked from M-Labs/thermostat
nix: build with fetchcargo
This commit is contained in:
parent
3f6bb05001
commit
7d50391af0
|
@ -13,9 +13,9 @@ dependencies = [
|
||||||
"panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"panic-abort 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"panic-semihosting 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"panic-semihosting 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"stm32-eth 0.1.0 (git+https://github.com/stm32-rs/stm32-eth.git)",
|
"stm32-eth 0.1.0 (git+https://github.com/stm32-rs/stm32-eth)",
|
||||||
"stm32f4 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"stm32f4 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal.git)",
|
"stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -255,13 +255,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stm32-eth"
|
name = "stm32-eth"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/stm32-rs/stm32-eth.git#2c0f9daf91dc5f0a6cca3f69f0002fd045e25608"
|
source = "git+https://github.com/stm32-rs/stm32-eth#2c0f9daf91dc5f0a6cca3f69f0002fd045e25608"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aligned 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cortex-m-semihosting 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cortex-m-semihosting 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal.git)",
|
"stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal)",
|
||||||
"volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"volatile-register 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stm32f4xx-hal"
|
name = "stm32f4xx-hal"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "git+https://github.com/stm32-rs/stm32f4xx-hal.git#9b882864619c9b41579bd73adadb4718fbd6caec"
|
source = "git+https://github.com/stm32-rs/stm32f4xx-hal#469d551aad67c2a8572698d62a59be3fbe2d4c96"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bare-metal 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -362,9 +362,9 @@ dependencies = [
|
||||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
|
"checksum smoltcp 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fef582369edb298c6c41319a544ca9c4e83622f226055ccfcb35974fbb55ed34"
|
||||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||||
"checksum stm32-eth 0.1.0 (git+https://github.com/stm32-rs/stm32-eth.git)" = "<none>"
|
"checksum stm32-eth 0.1.0 (git+https://github.com/stm32-rs/stm32-eth)" = "<none>"
|
||||||
"checksum stm32f4 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c590c1a30e6514af93d84ef3953c85ab81f12ba7fd1568703507038a34afde5d"
|
"checksum stm32f4 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c590c1a30e6514af93d84ef3953c85ab81f12ba7fd1568703507038a34afde5d"
|
||||||
"checksum stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal.git)" = "<none>"
|
"checksum stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal)" = "<none>"
|
||||||
"checksum syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)" = "525bd55255f03c816e5d7f615587bd13030c7103354fadb104993dcee6a788ec"
|
"checksum syn 0.15.27 (registry+https://github.com/rust-lang/crates.io-index)" = "525bd55255f03c816e5d7f615587bd13030c7103354fadb104993dcee6a788ec"
|
||||||
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
"checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169"
|
||||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||||
|
|
|
@ -28,9 +28,9 @@ cortex-m-log = { version = "0.4", features = ["log-integration"] }
|
||||||
stm32f4 = { version = "0.6", features = ["rt", "stm32f429"] }
|
stm32f4 = { version = "0.6", features = ["rt", "stm32f429"] }
|
||||||
embedded-hal = "0.2"
|
embedded-hal = "0.2"
|
||||||
#stm32f4xx-hal = { version = "0.3.0", features = ["rt", "stm32f429"] }
|
#stm32f4xx-hal = { version = "0.3.0", features = ["rt", "stm32f429"] }
|
||||||
stm32f4xx-hal = { git = "https://github.com/stm32-rs/stm32f4xx-hal.git", features = ["rt", "stm32f429"] }
|
stm32f4xx-hal = { git = "https://github.com/stm32-rs/stm32f4xx-hal", features = ["rt", "stm32f429"] }
|
||||||
#stm32-eth = { version = "0.1.1", features = ["smoltcp-phy", "nucleo-f429zi"] }
|
#stm32-eth = { version = "0.1.0", features = ["smoltcp-phy", "nucleo-f429zi"] }
|
||||||
stm32-eth = { git = "https://github.com/stm32-rs/stm32-eth.git", features = ["smoltcp-phy", "nucleo-f429zi"] }
|
stm32-eth = { git = "https://github.com/stm32-rs/stm32-eth", features = ["smoltcp-phy", "nucleo-f429zi"] }
|
||||||
smoltcp = { version = "0.5.0", default-features = false, features = ["proto-ipv4", "socket-tcp", "log"] }
|
smoltcp = { version = "0.5.0", default-features = false, features = ["proto-ipv4", "socket-tcp", "log"] }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -1,13 +1,45 @@
|
||||||
{ stdenv, rustPlatform }:
|
{ stdenv, rustPlatform, cacert, git, cargo-vendor }:
|
||||||
|
|
||||||
with rustPlatform;
|
with rustPlatform;
|
||||||
|
let
|
||||||
|
fetchcargo = import ./fetchcargo.nix {
|
||||||
|
inherit stdenv cacert git cargo-vendor;
|
||||||
|
inherit (rust) cargo;
|
||||||
|
};
|
||||||
|
adc2tcpDeps = fetchcargo {
|
||||||
|
name = "adc2tcp-deps";
|
||||||
|
src = ../.;
|
||||||
|
sha256 = "1wddmsdsqwfzld43g12l2r60ndfwi8ihwm03zzcs9722sirw49fz";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
buildRustPackage rec {
|
buildRustPackage rec {
|
||||||
name = "adc2tcp";
|
name = "adc2tcp";
|
||||||
version = "0.0.0";
|
version = "0.0.0";
|
||||||
|
|
||||||
src = ../.;
|
src = ../.;
|
||||||
cargoSha256 = "0q3cn3jzgmrqiymisxymn19vbnnpsj7if052w5zh25x9ikin6lpl";
|
cargoSha256 = "1wddmsdsqwfzld43g12l2r60ndfwi8ihwm03zzcs9722sirw49fz";
|
||||||
|
|
||||||
|
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
|
||||||
|
'';
|
||||||
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
{ stdenv, cacert, git, cargo, cargo-vendor }:
|
||||||
|
{ name, src, sha256 }:
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "${name}-vendor";
|
||||||
|
nativeBuildInputs = [ cacert git cargo cargo-vendor ];
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
phases = "unpackPhase patchPhase installPhase";
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
if [[ ! -f Cargo.lock ]]; then
|
||||||
|
echo
|
||||||
|
echo "ERROR: The Cargo.lock file doesn't exist"
|
||||||
|
echo
|
||||||
|
echo "Cargo.lock is needed to make sure that cargoSha256 doesn't change"
|
||||||
|
echo "when the registry is updated."
|
||||||
|
echo
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
|
||||||
|
|
||||||
|
cargo vendor
|
||||||
|
|
||||||
|
cp -ar vendor $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHash = sha256;
|
||||||
|
|
||||||
|
impureEnvVars = stdenv.lib.fetchers.proxyImpureEnvVars;
|
||||||
|
preferLocalBuild = true;
|
||||||
|
}
|
Loading…
Reference in New Issue