X-Git-Url: http://git.scottworley.com/tattlekey/blobdiff_plain/e2173399236a55d37e243f666f4052605517699c..8c76d103da962e8c973f16df51c2e6bbacd00d3a:/client/default.nix diff --git a/client/default.nix b/client/default.nix index ed65ca2..eb65f49 100644 --- a/client/default.nix +++ b/client/default.nix @@ -1,28 +1,58 @@ -{ pkgs ? import ~/devel/nixpkgs { }, }: +{ pkgs ? import { }, }: let - cc = pkgs.pkgsCross.arm-embedded.stdenv.cc; - tattlekey = { lib, stdenv, cmake, pico-sdk, python3 }: + + tattlekey = { lib, stdenv, cmake, pico-sdk, pico-examples, python3 }: stdenv.mkDerivation { pname = "tattlekey"; version = "0.0.1"; src = lib.cleanSource ./.; nativeBuildInputs = [ cmake python3 ]; + postUnpack = '' + # Per https://datasheets.raspberrypi.com/picow/connecting-to-the-internet-with-pico-w.pdf page 9 + cp ${pico-examples}/pico_w/wifi/lwipopts_examples_common.h lwipopts.h + ''; 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" ]; - /* - installPhase = '' - runHook preInstall + diskImage = debImage; + diskImageFormat = "qcow2"; + }; - mkdir $out - mv build/tattlekey.* $out + pico-sdk-version = "1.5.1"; - runHook postInstall - ''; - */ + pico-sdk = pkgs.pico-sdk.overrideAttrs (old: { + version = pico-sdk-version; + src = pkgs.fetchFromGitHub { + fetchSubmodules = true; + owner = "raspberrypi"; + repo = "pico-sdk"; + rev = pico-sdk-version; + hash = "sha256-GY5jjJzaENL3ftuU5KpEZAmEZgyFRtLwGVg3W1e/4Ho="; + }; + }); + + pico-examples = pkgs.fetchFromGitHub { + fetchSubmodules = true; + owner = "raspberrypi"; + repo = "pico-examples"; + rev = "sdk-${pico-sdk-version}"; + hash = "sha256-mJIOWUqsQJcg7FUWZePf+pA/YblZskDtIVnUJiz7szU="; }; -in pkgs.callPackage tattlekey {} + + 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 { inherit pico-examples pico-sdk; })