]> git.scottworley.com Git - tattlekey/blame - client/default.nix
client: Rename the event enum values
[tattlekey] / client / default.nix
CommitLineData
9e450553 1{ pkgs ? import <nixpkgs> { }, }:
5ec2b60a 2let
38087506 3
8655eb01 4 tattlekey = { lib, stdenv, cmake, pico-sdk, pico-examples, python3 }:
5ec2b60a
SW
5 stdenv.mkDerivation {
6 pname = "tattlekey";
7 version = "0.0.1";
8 src = lib.cleanSource ./.;
9 nativeBuildInputs = [ cmake python3 ];
8655eb01
SW
10 postUnpack = ''
11 # Per https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf page 9
12 cp ${pico-examples}/pico_w/wifi/lwipopts_examples_common.h lwipopts.h
13 '';
5ec2b60a 14 cmakeFlags = [
38087506
SW
15 "-DCMAKE_C_COMPILER=/usr/bin/arm-none-eabi-gcc"
16 "-DCMAKE_CXX_COMPILER=/usr/bin/arm-none-eabi-c++"
e2173399 17 "-DPICO_BOARD=pico_w"
9e450553 18 "-DPICO_SDK_PATH=${pico-sdk}/lib/pico-sdk"
5ec2b60a 19 ];
38087506
SW
20 diskImage = debImage;
21 diskImageFormat = "qcow2";
5ec2b60a 22 };
9e450553 23
8655eb01
SW
24 pico-sdk-version = "1.5.1";
25
26 pico-sdk = pkgs.pico-sdk.overrideAttrs (old: {
27 version = pico-sdk-version;
9e450553
SW
28 src = pkgs.fetchFromGitHub {
29 fetchSubmodules = true;
30 owner = "raspberrypi";
31 repo = "pico-sdk";
8655eb01 32 rev = pico-sdk-version;
9e450553
SW
33 hash = "sha256-GY5jjJzaENL3ftuU5KpEZAmEZgyFRtLwGVg3W1e/4Ho=";
34 };
35 });
36
8655eb01
SW
37 pico-examples = pkgs.fetchFromGitHub {
38 fetchSubmodules = true;
39 owner = "raspberrypi";
40 repo = "pico-examples";
41 rev = "sdk-${pico-sdk-version}";
42 hash = "sha256-mJIOWUqsQJcg7FUWZePf+pA/YblZskDtIVnUJiz7szU=";
43 };
44
38087506
SW
45 distro = "debian11x86_64";
46
47 extraPackages = [
48 "build-essential"
49 "cmake"
50 "gcc-arm-none-eabi"
51 "libnewlib-arm-none-eabi"
52 "libstdc++-arm-none-eabi-newlib"
53 ];
54
55 debImage = pkgs.vmTools.diskImageFuns."${distro}" { inherit extraPackages; };
56
57in pkgs.vmTools.runInLinuxImage
8655eb01 58(pkgs.callPackage tattlekey { inherit pico-examples pico-sdk; })