From 7d50391af0dc2418b9852e7212d6a0b952bcb01e Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 18 Mar 2019 23:09:54 +0100 Subject: [PATCH] nix: build with fetchcargo --- Cargo.lock | 14 +++++++------- Cargo.toml | 6 +++--- nix/adc2tcp.nix | 36 ++++++++++++++++++++++++++++++++++-- nix/fetchcargo.nix | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+), 12 deletions(-) create mode 100644 nix/fetchcargo.nix diff --git a/Cargo.lock b/Cargo.lock index 4173ba7..854bfd6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ "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)", "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)", - "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]] @@ -255,13 +255,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "stm32-eth" 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 = [ "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)", "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)", - "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)", ] @@ -279,7 +279,7 @@ dependencies = [ [[package]] name = "stm32f4xx-hal" 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 = [ "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)", @@ -362,9 +362,9 @@ dependencies = [ "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 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)" = "" +"checksum stm32-eth 0.1.0 (git+https://github.com/stm32-rs/stm32-eth)" = "" "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)" = "" +"checksum stm32f4xx-hal 0.3.0 (git+https://github.com/stm32-rs/stm32f4xx-hal)" = "" "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 unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" diff --git a/Cargo.toml b/Cargo.toml index b15435d..f67ed06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,9 +28,9 @@ cortex-m-log = { version = "0.4", features = ["log-integration"] } stm32f4 = { version = "0.6", features = ["rt", "stm32f429"] } embedded-hal = "0.2" #stm32f4xx-hal = { version = "0.3.0", features = ["rt", "stm32f429"] } -stm32f4xx-hal = { git = "https://github.com/stm32-rs/stm32f4xx-hal.git", features = ["rt", "stm32f429"] } -#stm32-eth = { version = "0.1.1", features = ["smoltcp-phy", "nucleo-f429zi"] } -stm32-eth = { git = "https://github.com/stm32-rs/stm32-eth.git", features = ["smoltcp-phy", "nucleo-f429zi"] } +stm32f4xx-hal = { git = "https://github.com/stm32-rs/stm32f4xx-hal", features = ["rt", "stm32f429"] } +#stm32-eth = { version = "0.1.0", 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"] } [features] diff --git a/nix/adc2tcp.nix b/nix/adc2tcp.nix index dcebd94..3d74223 100644 --- a/nix/adc2tcp.nix +++ b/nix/adc2tcp.nix @@ -1,13 +1,45 @@ -{ stdenv, rustPlatform }: +{ stdenv, rustPlatform, cacert, git, cargo-vendor }: 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 { name = "adc2tcp"; version = "0.0.0"; src = ../.; - cargoSha256 = "0q3cn3jzgmrqiymisxymn19vbnnpsj7if052w5zh25x9ikin6lpl"; + cargoSha256 = "1wddmsdsqwfzld43g12l2r60ndfwi8ihwm03zzcs9722sirw49fz"; + + buildInputs = [ adc2tcpDeps ]; + patchPhase = '' + cat >> .cargo/config <