Thu Nov 7 15:46:34 EST 2019

Packaging buildroot

I want to do it properly.

Buildroot is not the problem.
The toolchain is.

So how to package the toolchain separately?

Or, use crosstool-ng, which is mentioned here:


That page also mentions the main point:

    In general, all toolchains that support the _sysroot_ feature
    should work.

Maybe best to start somewhere else?


Googling a bit.  Found this:


buildInputs = with pkgs; [ gnumake pkgsCross.muslpi.buildPackages.gcc ];

Wich has:

[nix-shell:~/exo/nix/arm-embedded]$ readlink $(which arm-none-eabi-gcc)

Pff.. figure this out some other time.  Not really documented?

Since buildroot mentions crosstool-ng, maybe just use that instead?

unpacking source archive /nix/store/pflqnc2zdnxd92rn1659qmgiyb3x13nx-crosstool-ng-1.23.0.tar.bz2
source root is cmdliner-1.0.2
setting SOURCE_DATE_EPOCH to timestamp 1502118649 of file cmdliner-1.0.2/test/test_term_dups.ml
patching sources
no configure script, doing nothing
build flags: SHELL=/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash
ocamlbuild -use-ocamlfind src/cmdliner.cma
/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash: ocamlbuild: command not found
make: *** [Makefile:44: build-byte] Error 127
builder for '/nix/store/zcrlkkhqy41jlfyi6lcf3q3jhk9swhmf-crosstool-ng.drv' failed with exit code 2
error: build of '/nix/store/zcrlkkhqy41jlfyi6lcf3q3jhk9swhmf-crosstool-ng.drv' failed
tom@panda:~/exo/nix/crosstool-ng$ ls -al
total 12
drwxr-xr-x 1 tom tom  86 Nov  7 16:33 .
drwxr-xr-x 1 tom tom 124 Nov  7 16:13 ..
-rw-r--r-- 1 tom tom 280 Nov  7 16:33 default.nix
lrwxrwxrwx 1 tom tom  28 Nov  7 16:23 .#Makefile -> tom@panda.zoo.977:1572787197
-rw-r--r-- 1 tom tom  29 Nov  7 16:25 #Makefile#
-rw-r--r-- 1 tom tom   0 Nov  7 16:22 Makefile~
drwxr-xr-x 1 tom tom  28 Nov  7 16:30 tmp

EDIT: Do not just copy hashes! It will try to download it from somewhere else.

{ pkgs ? import ../../deps/nixpkgs {} }:
pkgs.stdenv.mkDerivation {
  name = "crosstool-ng";
  src = pkgs.fetchurl {
    url = "https://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.24.0.tar.bz2";
    # Do not
    sha256 = "18jqphjiifljlh9jg8zpl6310p3iwyaqphdkmf89acyaix0s4kj1";

EDIT: Wrapping nix is hard.  Emulating nix-build just isn't very easy
for large builds.

these things are really at odds.
i'm resisting.