Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • F firmware
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 29
    • Merge requests 29
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • card10card10
  • firmware
  • Issues
  • #102
Closed
Open
Issue created Aug 21, 2019 by adisbladis@adisbladis

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.

Assignee
Assign to
Time tracking