-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathshell.nix
83 lines (71 loc) · 2.01 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# 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.13.0";
sha256 = "sha256-NRcCPTrLFZLubI5KzMmDkKJdvCdbnW97JMZSmedAQ8s=";
}) { 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=";
};
cargoHash = "sha256-UHAwk1fBcabRqy7VMhz4aoQuIur+MQshDOhC7KFyGm4=";
};
# The formatting scripts require a specific version of uncrustify:
uncrustify-0_75_1 = stdenv.mkDerivation rec {
pname = "uncrustify";
version = "0.75.1";
src = pkgs.fetchFromGitHub {
owner = "uncrustify";
repo = "uncrustify";
rev = "uncrustify-${version}";
sha256 = "sha256-wLzj/KcqXlcTsOJo7T166jLcWi1KNLmgblIqqkj7/9c=";
};
nativeBuildInputs = with pkgs; [
cmake
python3
];
};
in
pkgs.mkShell {
name = "tock-dev";
buildInputs = with pkgs; [
elf2tab
gcc-arm-embedded
python3Full
tockloader
pkgsCross.riscv32-embedded.buildPackages.gcc
unzip
openocd
uncrustify-0_75_1
] ++ (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.libusb1}/lib:$LD_LIBRARY_PATH
'' + (lib.optionalString withUnfreePkgs ''
export LD_LIBRARY_PATH=${pkgs.segger-jlink}/lib:$LD_LIBRARY_PATH
'');
}