66#
77# This nix expression creates an environment with necessary packages installed:
88#
9+ # * `tockloader`
910# * rust
1011#
1112# To use:
@@ -19,14 +20,31 @@ with builtins;
1920let
2021 inherit ( pkgs ) stdenv lib ;
2122
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+
2338 nixpkgs = import <nixpkgs> { overlays = [ rust_overlay ] ; } ;
2439
2540 # Get a custom cross-compile capable Rust install of a specific channel and
2641 # build. Tock expects a specific version of Rust with a selection of targets
2742 # and components to be present.
2843 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 ; }
3048 ) ;
3149
3250in
3654 buildInputs = with pkgs ; [
3755 # --- Toolchains ---
3856 rustBuild
57+ rustBuildNightly
3958 openocd
4059
4160 # --- Convenience and support packages ---
4867
4968 # --- CI support packages ---
5069 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;
5182 ] ;
5283
5384 LD_LIBRARY_PATH = "${ stdenv . cc . cc . lib } /lib64:$LD_LIBRARY_PATH" ;
6192 shellHook = ''
6293 unset OBJCOPY
6394 unset OBJDUMP
95+
96+ alias use_stable_toolchain=PATH=${ rustBuild } /bin:$PATH
97+ alias use_nightly_toolchain=PATH=${ rustBuildNightly } /bin:$PATH
6498 '' ;
6599 }
0 commit comments