I’m trying to figure out how to, with modern NixOS tooling, set up a flake that I can use to build programs for avr processors. While I have no problems getting a clang compiler that will happily target an avr processor, I can’t figure out how to get the header files into the environment.
Here’s my flake:
{
description = "avr";
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.11";
};
outputs = { self, nixpkgs }:
let
version = builtins.string 0 8 self.lastModifiedDate;
supportedSystems = [ "x86_64-linux" "avr-none" ];
in
{
devShell."x86_64-linux" =
let
pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnsupportedSystem = true; };
in
pkgs.mkShell {
name = "avr-shell";
buildInputs = [
pkgs.clang_14
pkgs.avrdude
pkgs.avrlibc
];
};
};
}
But the error I get is this:
error: builder for '/nix/store/cq7q7jmyppfzvzm7njm0zl6pdry7l8dg-avr-libc-2.0.0.drv' failed with exit code 1;
last 10 log lines:
> configure flags: --disable-dependency-tracking --prefix=/nix/store/amsw42qn701h75kdawp9bp59dqf249f5-avr-libc-2.0.0
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... x86_64-unknown-linux-gnu
> checking if configuring for cross compile... no
> configure: WARNING:
> configure: WARNING: AVR-LIBC must be built using an avr cross-compiler.
> configure: WARNING: Try configuring with:
> configure: WARNING: "./configure --build=`./config.guess` --host=avr"
> configure: WARNING:
> configure: error: aborting configure
For full logs, run 'nix log /nix/store/cq7q7jmyppfzvzm7njm0zl6pdry7l8dg-avr-libc-2.0.0.drv'.
error: 1 dependencies of derivation '/nix/store/j7jr4h87bmdz26j8lvy92fxc16qscf66-Wearables-shell-env.drv' failed to build
So, yeah, it makes sense that avr-libc can’t be compiled with an x86_64-linux target, but how can I tell the avrlibc package to just build for avr, instead?