6
6
#
7
7
# This nix expression creates an environment with necessary packages installed:
8
8
#
9
+ # * `tockloader`
9
10
# * rust
10
11
#
11
12
# To use:
@@ -19,14 +20,31 @@ with builtins;
19
20
let
20
21
inherit ( pkgs ) stdenv lib ;
21
22
22
- rust_overlay = import ( builtins . fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz" ) ;
23
+ # Tockloader v1.11.0
24
+ tockloader = import ( pkgs . fetchFromGitHub {
25
+ owner = "tock" ;
26
+ repo = "tockloader" ;
27
+ rev = "v1.11.0" ;
28
+ sha256 = "sha256-bPEfpfOZOjOiazqRgn1cnqe4ohLPvocuENKoZx/Qw80=" ;
29
+ } ) { inherit pkgs withUnfreePkgs ; } ;
30
+
31
+ rust_overlay = import "${ pkgs . fetchFromGitHub {
32
+ owner = "nix-community" ;
33
+ repo = "fenix" ;
34
+ rev = "1a92c6d75963fd594116913c23041da48ed9e020" ;
35
+ sha256 = "sha256-L3vZfifHmog7sJvzXk8qiKISkpyltb+GaThqMJ7PU9Y=" ;
36
+ } } /overlay.nix";
37
+
23
38
nixpkgs = import <nixpkgs> { overlays = [ rust_overlay ] ; } ;
24
39
25
40
# Get a custom cross-compile capable Rust install of a specific channel and
26
41
# build. Tock expects a specific version of Rust with a selection of targets
27
42
# and components to be present.
28
43
rustBuild = (
29
- nixpkgs . rust-bin . fromRustupToolchainFile ./rust-toolchain.toml
44
+ nixpkgs . fenix . fromToolchainFile { file = ./rust-toolchain.toml ; }
45
+ ) ;
46
+ rustBuildNightly = (
47
+ nixpkgs . fenix . fromToolchainFile { file = ./nightly/rust-toolchain.toml ; }
30
48
) ;
31
49
32
50
in
36
54
buildInputs = with pkgs ; [
37
55
# --- Toolchains ---
38
56
rustBuild
57
+ rustBuildNightly
39
58
openocd
40
59
41
60
# --- Convenience and support packages ---
48
67
49
68
# --- CI support packages ---
50
69
qemu
70
+
71
+ # --- Flashing tools ---
72
+ # If your board requires J-Link to flash and you are on NixOS,
73
+ # add these lines to your system wide configuration.
74
+
75
+ # Enable udev rules from segger-jlink package
76
+ # services.udev.packages = [
77
+ # pkgs.segger-jlink
78
+ # ];
79
+
80
+ # Add "segger-jlink" to your system packages and accept the EULA:
81
+ # nixpkgs.config.segger-jlink.acceptLicense = true;
51
82
] ;
52
83
53
84
LD_LIBRARY_PATH = "${ stdenv . cc . cc . lib } /lib64:$LD_LIBRARY_PATH" ;
61
92
shellHook = ''
62
93
unset OBJCOPY
63
94
unset OBJDUMP
95
+
96
+ alias use_stable_toolchain=PATH=${ rustBuild } /bin:$PATH
97
+ alias use_nightly_toolchain=PATH=${ rustBuildNightly } /bin:$PATH
64
98
'' ;
65
99
}
0 commit comments