thermostat/nix/adc2tcp.nix

46 lines
935 B
Nix
Raw Normal View History

2019-05-10 05:18:00 +08:00
{ stdenv, rustPlatform, cacert, git, cargo-vendor, coreutils }:
2019-03-07 23:27:33 +08:00
with rustPlatform;
2019-03-19 06:09:54 +08:00
let
2019-05-10 03:04:18 +08:00
sha256 = "19cdc0lkm9247n6kf23ki66gysz530j1x2lfnzq7n0cpcs53q3h3";
2019-03-19 06:09:54 +08:00
fetchcargo = import ./fetchcargo.nix {
2019-05-10 05:18:00 +08:00
inherit stdenv cacert git cargo-vendor coreutils;
2019-03-19 06:09:54 +08:00
inherit (rust) cargo;
};
adc2tcpDeps = fetchcargo {
name = "adc2tcp";
2019-03-19 06:09:54 +08:00
src = ../.;
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 = ../.;
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}"
EOF
'';
2019-03-07 23:27:33 +08:00
buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
cargo build --release
'';
2019-03-07 23:27:33 +08:00
doCheck = false;
2019-03-08 01:24:21 +08:00
installPhase = ''
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
}