]> git.scottworley.com Git - tattlekey/commitdiff
client: Build in a Debian VM
authorScott Worley <scottworley@scottworley.com>
Fri, 29 Sep 2023 19:37:21 +0000 (12:37 -0700)
committerScott Worley <scottworley@scottworley.com>
Wed, 11 Oct 2023 01:47:29 +0000 (18:47 -0700)
This finally makes it work.  Hurray!

Other things I tried that didn't help:
  * Other versions of cross gcc (8, 9, 10, 11 12)
  * Other versions of host gcc (10)
  * Other versions of pico-sdk (1.3.1, 1.4.0)

arm-none-eabi-gcc as packaged in Debian works.
arm-none-eabi-gcc as packaged in Nix doesn't.
I haven't yet looked further into why.

client/default.nix

index 322cf6667cd58bc12eaaa14620aade0fd1b71ce4..a2bbf91ac984bde432f6fdd23bf3e7b2e6c73615 100644 (file)
@@ -1,6 +1,6 @@
 { pkgs ? import <nixpkgs> { }, }:
 let
 { pkgs ? import <nixpkgs> { }, }:
 let
-  cc = pkgs.pkgsCross.arm-embedded.stdenv.cc;
+
   tattlekey = { lib, stdenv, cmake, pico-sdk, python3 }:
     stdenv.mkDerivation {
       pname = "tattlekey";
   tattlekey = { lib, stdenv, cmake, pico-sdk, python3 }:
     stdenv.mkDerivation {
       pname = "tattlekey";
@@ -8,12 +8,13 @@ let
       src = lib.cleanSource ./.;
       nativeBuildInputs = [ cmake python3 ];
       cmakeFlags = [
       src = lib.cleanSource ./.;
       nativeBuildInputs = [ cmake python3 ];
       cmakeFlags = [
-        "-DCMAKE_C_COMPILER=${cc}/bin/arm-none-eabi-cc"
-        "-DCMAKE_CXX_COMPILER=${cc}/bin/arm-none-eabi-c++"
+        "-DCMAKE_C_COMPILER=/usr/bin/arm-none-eabi-gcc"
+        "-DCMAKE_CXX_COMPILER=/usr/bin/arm-none-eabi-c++"
         "-DPICO_BOARD=pico_w"
         "-DPICO_SDK_PATH=${pico-sdk}/lib/pico-sdk"
         "-DPICO_BOARD=pico_w"
         "-DPICO_SDK_PATH=${pico-sdk}/lib/pico-sdk"
-        "-DPICO_TOOLCHAIN_PATH=${cc}/bin"
       ];
       ];
+      diskImage = debImage;
+      diskImageFormat = "qcow2";
     };
 
   pico-sdk = pkgs.pico-sdk.overrideAttrs (old: rec {
     };
 
   pico-sdk = pkgs.pico-sdk.overrideAttrs (old: rec {
@@ -27,4 +28,17 @@ let
     };
   });
 
     };
   });
 
-in pkgs.callPackage tattlekey { inherit pico-sdk; }
+  distro = "debian11x86_64";
+
+  extraPackages = [
+    "build-essential"
+    "cmake"
+    "gcc-arm-none-eabi"
+    "libnewlib-arm-none-eabi"
+    "libstdc++-arm-none-eabi-newlib"
+  ];
+
+  debImage = pkgs.vmTools.diskImageFuns."${distro}" { inherit extraPackages; };
+
+in pkgs.vmTools.runInLinuxImage
+(pkgs.callPackage tattlekey { pico-sdk = pico-sdk; })