forked from tock/libtock-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
69 lines (61 loc) · 1.87 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Shell expression for the Nix package manager
#
# This nix expression creates an environment with necessary packages installed:
#
# * `tockloader`
# * arm-none-eabi toolchain
# * elf2tab
# * riscv32-embedded toolchain
#
# To use:
#
# $ nix-shell
{ pkgs ? import <nixpkgs> {}, withUnfreePkgs ? false }:
with builtins;
let
inherit (pkgs) stdenv stdenvNoCC lib;
tockloader = import (pkgs.fetchFromGitHub {
owner = "tock";
repo = "tockloader";
rev = "v1.11.0";
sha256 = "sha256-bPEfpfOZOjOiazqRgn1cnqe4ohLPvocuENKoZx/Qw80=";
}) { inherit pkgs withUnfreePkgs; };
elf2tab = pkgs.rustPlatform.buildRustPackage rec {
name = "elf2tab-${version}";
version = "0.12.0";
src = pkgs.fetchFromGitHub {
owner = "tock";
repo = "elf2tab";
rev = "v${version}";
sha256 = "sha256-+VeWLBI6md399Oaumt4pJrOkm0Nz7fmpXN2TjglUE34=";
};
cargoSha256 = "sha256-UHAwk1fBcabRqy7VMhz4aoQuIur+MQshDOhC7KFyGm4=";
};
in
pkgs.mkShell {
name = "tock-dev";
buildInputs = with pkgs; [
elf2tab
gcc-arm-embedded
python3Full
tockloader
pkgsCross.riscv32-embedded.buildPackages.gcc
];
# Unfortunately, `segger-jlink` has been removed from Nixpkgs due to its
# hard dependency in Qt4, which has multiple security issues and is
# deprecated since a few years now. Efforts exist to bring the package back,
# but for now we don't assume it's available. Once [1] is merged, we can add
# the following back:
#
# buildInputs ++ (lib.optionals withUnfreePkgs [
# segger-jlink
# tockloader.nrf-command-line-tools
# ])
#
# shellHook = ''
# # TODO: This should be patched into the rpath of the respective libraries!
# export LD_LIBRARY_PATH=${pkgs.libusb}/lib:${pkgs.segger-jlink}/lib:$LD_LIBRARY_PATH
# '';
#
# [1]: https://github.com/NixOS/nixpkgs/pull/255185
}