Struggling to install avr-gcc

I see a couple references to avr-gcc being available on nixos, but I can’t find any reference to the package on nixos.org

How can I install these? Do I need to build them from scratch? If so, could you point me in the direction of some documentation on how to do that?

I have a lot of linux experience, but I’d like to do things the nixos/nix way where possible.

Taking a look at https://github.com/NixOS/nixpkgs/blob/5c56778efdcaa1b8088eb536c3f1e9cc110930dc/lib/systems/examples.nix (where target systems are defined) there’s an avr entry. By combining it with the Cross Compiling - NixOS Wiki article I was able to create a nix-shell which contains avr-gcc simply by swapping the aarch64-unknown-linux-gnu target with the avr target.

Hi,

I’m also a newbie here but I figured out a way with nix-shell like this:

with import <nixpkgs> {};                                                 
stdenv.mkDerivation {
	name = "avr-stuff";
	buildInputs = [ arduino ];
	shellHook =
	''
	export PATH=$PATH:${arduino}/share/arduino/hardware/tools/avr/bin/
	'';   
}

Not sure if this is the right way but it works for me :slight_smile:

Cheers!

For future reference, AVR GCC is available via pkgs.pkgsCross.avr.buildPackages.gcc.

11 Likes

I tried using that package for a build shell, and the avr-gcc wrapper generated by the derivation seems to introduce some wrong arguments, because I’m getting the error

> avr-gcc
avr-gcc: error: unrecognized command-line option ‘-iframework’
avr-gcc: error: unrecognized command-line option ‘-iframework’
avr-gcc: error: unrecognized command-line option ‘-iframework’
avr-gcc: error: unrecognized command-line option ‘-iframework’

Any idea how I can fix this?