Build cross toolchain using Nix
I made a Nix expression to get the cross toolchain up and running:
with import <nixpkgs> {};
let
ocd = openocd.overrideAttrs(old: {
name = "openocd-cardio";
src = pkgs.fetchgit {
url = "https://git.card10.badge.events.ccc.de/card10/openocd.git";
rev = "90d828185cea44b29cffb40f2c8aea19282b9130";
sha256 = "092wg19kjapv9s70b23ckd4j5i8ykk3d7mcl4h8cgl2acwcw8myr";
fetchSubmodules = true;
};
nativeBuildInputs = old.nativeBuildInputs ++ [
which
libtool
autoconf
automake
];
SKIP_SUBMODULE="1";
preConfigure = ''
./bootstrap
'';
});
in pkgsCross.arm-embedded.stdenv.mkDerivation {
name = "crossenv";
buildInputs = [
gdb
ocd
];
}
Save this file as shell.nix
and invoke nix-shell
, this will then download the toolchain from the Nix binary cache and build the custom OpenOCD package.
This should also be portable to MacOS.