X-Git-Url: http://git.scottworley.com/tattlekey/blobdiff_plain/661f51ad9c5a206f6d06b670c969d4cbd9c7b898..3808750687e7b6f953c251ae1281be5309d7d736:/client/default.nix diff --git a/client/default.nix b/client/default.nix index 58b928e..a2bbf91 100644 --- a/client/default.nix +++ b/client/default.nix @@ -1,6 +1,6 @@ -{ pkgs ? import ~/devel/nixpkgs { }, }: +{ pkgs ? import { }, }: let - cc = pkgs.pkgsCross.arm-embedded.stdenv.cc; + tattlekey = { lib, stdenv, cmake, pico-sdk, python3 }: stdenv.mkDerivation { pname = "tattlekey"; @@ -8,11 +8,37 @@ let 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.override { minimal = false; }}/lib/pico-sdk" - "-DPICO_TOOLCHAIN_PATH=${cc}/bin" + "-DPICO_SDK_PATH=${pico-sdk}/lib/pico-sdk" ]; + diskImage = debImage; + diskImageFormat = "qcow2"; }; -in pkgs.callPackage tattlekey {} + + pico-sdk = pkgs.pico-sdk.overrideAttrs (old: rec { + version = "1.5.1"; + src = pkgs.fetchFromGitHub { + fetchSubmodules = true; + owner = "raspberrypi"; + repo = "pico-sdk"; + rev = version; + hash = "sha256-GY5jjJzaENL3ftuU5KpEZAmEZgyFRtLwGVg3W1e/4Ho="; + }; + }); + + 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; })