]> git.scottworley.com Git - tattlekey/blame - client/default.nix
client: Build in a Debian VM
[tattlekey] / client / default.nix
CommitLineData
9e450553 1{ pkgs ? import <nixpkgs> { }, }:
5ec2b60a 2let
38087506 3
5ec2b60a
SW
4 tattlekey = { lib, stdenv, cmake, pico-sdk, python3 }:
5 stdenv.mkDerivation {
6 pname = "tattlekey";
7 version = "0.0.1";
8 src = lib.cleanSource ./.;
9 nativeBuildInputs = [ cmake python3 ];
10 cmakeFlags = [
38087506
SW
11 "-DCMAKE_C_COMPILER=/usr/bin/arm-none-eabi-gcc"
12 "-DCMAKE_CXX_COMPILER=/usr/bin/arm-none-eabi-c++"
e2173399 13 "-DPICO_BOARD=pico_w"
9e450553 14 "-DPICO_SDK_PATH=${pico-sdk}/lib/pico-sdk"
5ec2b60a 15 ];
38087506
SW
16 diskImage = debImage;
17 diskImageFormat = "qcow2";
5ec2b60a 18 };
9e450553
SW
19
20 pico-sdk = pkgs.pico-sdk.overrideAttrs (old: rec {
21 version = "1.5.1";
22 src = pkgs.fetchFromGitHub {
23 fetchSubmodules = true;
24 owner = "raspberrypi";
25 repo = "pico-sdk";
26 rev = version;
27 hash = "sha256-GY5jjJzaENL3ftuU5KpEZAmEZgyFRtLwGVg3W1e/4Ho=";
28 };
29 });
30
38087506
SW
31 distro = "debian11x86_64";
32
33 extraPackages = [
34 "build-essential"
35 "cmake"
36 "gcc-arm-none-eabi"
37 "libnewlib-arm-none-eabi"
38 "libstdc++-arm-none-eabi-newlib"
39 ];
40
41 debImage = pkgs.vmTools.diskImageFuns."${distro}" { inherit extraPackages; };
42
43in pkgs.vmTools.runInLinuxImage
44(pkgs.callPackage tattlekey { pico-sdk = pico-sdk; })