nix flakes support #64

Merged
sb10q merged 7 commits from mwojcik/thermostat:nixflakes into master 2022-01-19 11:13:47 +08:00
Showing only changes of commit af9f3903be - Show all commits

View File

@ -40,19 +40,11 @@
}; };
}; };
patchPhase = "";
nativeBuildInputs = [ pkgs.llvm ]; nativeBuildInputs = [ pkgs.llvm ];
buildPhase = '' buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX)
cargo build --release --bin thermostat cargo build --release --bin thermostat
Review

cargoBuildFlags?

cargoBuildFlags?
Review

Is there API of that function described somewhere for quick reference? Besides the little tutorial section...

Is there API of that function described somewhere for quick reference? Besides the little tutorial section...
Review

Actually, using just cargoBuildFlags (--bin thermostat as release is already included) causes the build to fail, as the default builder forces --target=x86_64-linux.

Actually, using just cargoBuildFlags (``--bin thermostat`` as release is already included) causes the build to fail, as the default builder forces ``--target=x86_64-linux``.
Review

One usually has to RTFS of nixpkgs for this kind of extended documentation :)
If there's no easy solution then overriding buildPhase is fine.

One usually has to RTFS of nixpkgs for this kind of extended documentation :) If there's no easy solution then overriding buildPhase is fine.
''; '';
checkPhase = ''
cargo test --target=${pkgs.rust.toRustTarget pkgs.stdenv.targetPlatform};
'';
# binaryName defaults to the `name` arg (i.e. the Rust package name);
# it is used as the Cargo binary filename
installPhase = '' installPhase = ''
mkdir -p $out $out/nix-support mkdir -p $out $out/nix-support
cp target/thumbv7em-none-eabihf/release/thermostat $out/thermostat.elf cp target/thumbv7em-none-eabihf/release/thermostat $out/thermostat.elf