bouk / arduino-nix

Manage your arduino-cli with Nix
MIT License
16 stars 4 forks source link

Using adafruit package source causes build to fail on building adafruit-arm-none-eabi-gcc-9-2019q4 #2

Open eyduh opened 1 year ago

eyduh commented 1 year ago

Trying to set up a project for some led fun with adafruit m0 boards, using this flake

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    arduino-nix.url = "github:bouk/arduino-nix";
    arduino-library-index = {
      url = "github:bouk/arduino-indexes/library_index";
      flake = false;
    };
    arduino-package-index = {
      url = "github:bouk/arduino-indexes/package_index";
      flake = false;
    };
    adafruit-package-index = {
      url = "github:adafruit/arduino-board-index";
      flake = false;
    };
  };

  outputs = {
    self,
    nixpkgs,
    flake-utils,
    arduino-nix,
    arduino-package-index,
    arduino-library-index,
    adafruit-package-index,
    ...
  }@attrs:
  let
    overlays = [
      (arduino-nix.overlay)
      (arduino-nix.mkArduinoPackageOverlay (arduino-package-index + "/package_index.json"))
      (arduino-nix.mkArduinoPackageOverlay (adafruit-package-index + "/package_adafruit_index.json"))
      (arduino-nix.mkArduinoLibraryOverlay (arduino-library-index + "/library_index.json"))
    ];
  in
  (flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = (import nixpkgs) {
          inherit system overlays;
        };
      in rec {
        packages.arduino-cli = pkgs.wrapArduinoCLI {
          libraries = with pkgs.arduinoLibraries; [
            (arduino-nix.latestVersion Adafruit_ZeroTimer)
            (arduino-nix.latestVersion FastLED)
            (arduino-nix.latestVersion Adafruit_TinyUSB)
          ];

          packages = with pkgs.arduinoPackages; [
            platforms.arduino.avr."1.6.23"
            platforms.adafruit.samd."1.7.13"
          ];
        };
      }
    ));
}

I get this error message when I build:

$ nix build .#arduino-cli --show-trace
error:
       … while evaluating the attribute 'buildCommand' of the derivation 'arduino-cli-wrapped'

       at /nix/store/vb9qsnpl4870flhx34lbwmwkdn1f1gxf-source/pkgs/stdenv/generic/make-derivation.nix:300:7:

          299|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          300|       name =
             |       ^
          301|         let

       … while evaluating the attribute 'paths' of the derivation 'arduino-data'

       at /nix/store/vb9qsnpl4870flhx34lbwmwkdn1f1gxf-source/pkgs/stdenv/generic/make-derivation.nix:300:7:

          299|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          300|       name =
             |       ^
          301|         let

       … while evaluating the attribute 'toolsDependencies' of the derivation 'adafruit-samd-1.7.13'

       at /nix/store/vb9qsnpl4870flhx34lbwmwkdn1f1gxf-source/pkgs/stdenv/generic/make-derivation.nix:300:7:

          299|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          300|       name =
             |       ^
          301|         let

       … while evaluating the attribute 'src' of the derivation 'adafruit-arm-none-eabi-gcc-9-2019q4'

       at /nix/store/vb9qsnpl4870flhx34lbwmwkdn1f1gxf-source/pkgs/stdenv/generic/make-derivation.nix:300:7:

          299|     // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
          300|       name =
             |       ^
          301|         let

       error: unsupported argument 'md5' to 'fetchurl'

       at /nix/store/pmfvdzrbqipqgsf3abszf1ljfk6y055y-source/lib.nix:46:9:

           45|     else
           46|       { md5 = h; };
             |         ^
           47| }

seems fetchurl doesn't like md5 hashes, provided by the gcc compiler dependency of adafruit samd.

plietar commented 10 months ago

I've run into the same issue and have opened https://github.com/adafruit/arduino-board-index/pull/110 in the hope that we can have it fixed directly upstream.