]> git.scottworley.com Git - tattlekey/blob - client/default.nix
a2bbf91ac984bde432f6fdd23bf3e7b2e6c73615
[tattlekey] / client / default.nix
1 { pkgs ? import <nixpkgs> { }, }:
2 let
3
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 = [
11 "-DCMAKE_C_COMPILER=/usr/bin/arm-none-eabi-gcc"
12 "-DCMAKE_CXX_COMPILER=/usr/bin/arm-none-eabi-c++"
13 "-DPICO_BOARD=pico_w"
14 "-DPICO_SDK_PATH=${pico-sdk}/lib/pico-sdk"
15 ];
16 diskImage = debImage;
17 diskImageFormat = "qcow2";
18 };
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
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
43 in pkgs.vmTools.runInLinuxImage
44 (pkgs.callPackage tattlekey { pico-sdk = pico-sdk; })