default.nix 900 Bytes
Newer Older
Astro's avatar
Astro committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
let
  mozillaOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz);
  pkgs = import <nixpkgs> { overlays = [ mozillaOverlay ]; };
in
with pkgs;
let
  openocd = callPackage ./openocd.nix {};
  rust = rustChannelOfTargets "nightly" null [ "thumbv7em-none-eabihf" ];
  rustPlatform = makeRustPlatform {
    rustc = rust;
    cargo = rust;
  };
  firmware = rustPlatform.buildRustPackage rec {
    name = "rust-card10";
    version = "0.0.0";
    src = ./.;
Astro's avatar
Astro committed
17
18
    cargoSha256 = "04blshy2c4xms9v8ik921qs3ym4vq8rsx8pw78brw7r88x6lx01a";
    buildInputs = [ pkgsCross.armhf-embedded.stdenv.cc ];
Astro's avatar
Astro committed
19
20
21
22
    preBuild = "export CARGO_HOME=$(mktemp -d cargo-home.XXX)";
    doCheck = false;
    installPhase = ''
      mkdir -p $out/lib
Astro's avatar
Astro committed
23
      cp target/thumbv7em-none-eabihf/release/watchapp $out/lib/
Astro's avatar
Astro committed
24
25
26
27
28
    '';
  };
in {
  inherit openocd rust rustPlatform firmware;
}