-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
92 lines (73 loc) · 2.48 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
84
85
86
87
88
89
90
91
92
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2022.
# Shell expression for the Nix package manager
#
# This nix expression creates an environment with necessary packages installed:
#
# * `tockloader`
# * rust
#
# To use:
#
# $ nix-shell
#
{ pkgs ? import <nixpkgs> {}, withUnfreePkgs ? false }:
with builtins;
let
inherit (pkgs) stdenv lib;
# Tockloader v1.11.0
tockloader = import (pkgs.fetchFromGitHub {
owner = "tock";
repo = "tockloader";
rev = "v1.11.0";
sha256 = "sha256-bPEfpfOZOjOiazqRgn1cnqe4ohLPvocuENKoZx/Qw80=";
}) { inherit pkgs withUnfreePkgs; };
rust_overlay = import "${pkgs.fetchFromGitHub {
owner = "nix-community";
repo = "fenix";
rev = "1a92c6d75963fd594116913c23041da48ed9e020";
sha256 = "sha256-L3vZfifHmog7sJvzXk8qiKISkpyltb+GaThqMJ7PU9Y=";
}}/overlay.nix";
nixpkgs = import <nixpkgs> { overlays = [ rust_overlay ]; };
# Get a custom cross-compile capable Rust install of a specific channel and
# build. Tock expects a specific version of Rust with a selection of targets
# and components to be present.
rustBuild = (
nixpkgs.fenix.fromToolchainFile { file = ./rust-toolchain.toml; }
);
in
pkgs.mkShell {
name = "tock-dev";
buildInputs = with pkgs; [
# --- Toolchains ---
rustBuild
openocd
# --- Convenience and support packages ---
python3Full
tockloader
# Required for tools/print_tock_memory_usage.py
python3Packages.cxxfilt
# --- CI support packages ---
qemu
# --- Flashing tools ---
# If your board requires J-Link to flash and you are on NixOS,
# add these lines to your system wide configuration.
# Enable udev rules from segger-jlink package
# services.udev.packages = [
# pkgs.segger-jlink
# ];
# Add "segger-jlink" to your system packages and accept the EULA:
# nixpkgs.config.segger-jlink.acceptLicense = true;
];
LD_LIBRARY_PATH="${stdenv.cc.cc.lib}/lib64:$LD_LIBRARY_PATH";
# Instruct the Tock gnumake-based build system to not check for rustup and
# assume all requirend tools are installed and available in the $PATH
NO_RUSTUP = "1";
# The defaults "objcopy" and "objdump" are wrong (stem from the standard
# environment for x86), use "llvm-obj{copy,dump}" as defined in the makefile
shellHook = ''
unset OBJCOPY
unset OBJDUMP
'';
}