Skip to content

Commit 6c3a4c7

Browse files
committed
Add rust-toolchain.toml + shell.nix files.
This makes it easier to start a devshell without using Docker.
1 parent 5fe4bcb commit 6c3a4c7

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

Dockerfile-devel

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
1-
FROM rust:1.66.1-buster
1+
FROM nixos/nix
22

3-
RUN apt-get update && \
4-
apt-get install -y \
5-
build-essential \
6-
cmake \
7-
clang \
8-
libclang-dev \
9-
llvm-dev \
10-
git \
11-
protobuf-compiler && \
12-
apt-get clean
13-
14-
RUN rustup component add rustfmt clippy
15-
RUN rustup target add armv5te-unknown-linux-gnueabi
16-
RUN rustup target add armv7-unknown-linux-gnueabihf
17-
RUN cargo install cargo-bitbake
18-
19-
# Install opkg-utils
20-
RUN git clone git://git.yoctoproject.org/opkg-utils /opt/opkg-utils && \
21-
cd /opt/opkg-utils && \
22-
make install
23-
24-
ENV LLVM_CONFIG_PATH=llvm-config
253
ENV PROJECT_PATH=/chirpstack-udp-forwarder
26-
RUN mkdir -p $PROJECT_PATH
274
WORKDIR $PROJECT_PATH
5+
6+
ENTRYPOINT ["nix-shell"]

docker-compose.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ services:
77
volumes:
88
- ./:/chirpstack-udp-forwarder
99
- ./.rust/target:/chirpstack-udp-forwarder/target
10-
- ./.rust/.cargo/registry/index:/usr/local/cargo/registry/index
11-
- ./.rust/.cargo/registry/cache:/usr/local/cargo/registry/cache
12-
- ./.rust/.cargo/git/db:/usr/local/cargo/git/db
10+
- ./.rust/rustup:/usr/local/rustup
11+
- ./.rust/cargo/registry/index:/usr/local/cargo/registry/index
12+
- ./.rust/cargo/registry/cache:/usr/local/cargo/registry/cache
13+
- ./.rust/cargo/git/db:/usr/local/cargo/git/db

rust-toolchain.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[toolchain]
2+
channel = "1.69.0"
3+
components = ["rustfmt", "clippy"]
4+
targets = ["armv5te-unknown-linux-gnueabi", "armv7-unknown-linux-gnueabihf"]
5+
profile = "default"

shell.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-22.11.tar.gz") {} }:
2+
3+
pkgs.mkShell {
4+
buildInputs = [
5+
pkgs.cacert
6+
pkgs.rustup
7+
pkgs.protobuf
8+
pkgs.cargo-bitbake
9+
];
10+
}

0 commit comments

Comments
 (0)