From 912bc2db242bc4152506addb374d7d50a81d38ee Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 18 Mar 2019 01:39:02 +0100 Subject: [PATCH] shell.nix: explicitly build gdb for targetPlatform arm-none-eabihf required for gdb 8.1.1 from nixos 18.09. --- shell.nix | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/shell.nix b/shell.nix index 4fc4d27..e5fbda8 100644 --- a/shell.nix +++ b/shell.nix @@ -2,11 +2,28 @@ let mozillaOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz); + pkgs = import { overlays = [ mozillaOverlay ]; }; + # `lib.systems.examples.armhf-embedded` from nixpkgs master + # (TODO: use directly starting with NixOS 19.0X) + targetPlatform = { + config = "arm-none-eabihf"; + libc = "newlib"; + }; in -with import { overlays = [ mozillaOverlay ]; }; +with pkgs; let rustPlatform = callPackage (import ./nix/rustPlatform.nix) { inherit rustChannel; }; openocd = callPackage (import ./nix/openocd.nix) {}; + # TODO: gdb 8.2.1 from NixOS >= 19.XX is multiarch by default. + # remove the following as `gdb` is already in scope + gdb = pkgs.gdb.override { + stdenv = stdenv.override { + targetPlatform = { + config = "arm-none-eabihf"; + libc = "newlib"; + }; + }; + }; in stdenv.mkDerivation { name = "adc2tcp-env"; @@ -25,6 +42,6 @@ stdenv.mkDerivation { sleep 1 echo "Run 'cargo build --release --features=semihosting'" - echo "Then 'gdb target/thumbv7em-none-eabihf/release/adc2tcp'" + echo "Then '${targetPlatform.config}-gdb target/thumbv7em-none-eabihf/release/adc2tcp'" ''; }