Skip to content

Commit aecd3b3

Browse files
committed
doc: Add a flake.nix to ease build environment setup
1 parent 920d2cc commit aecd3b3

File tree

3 files changed

+113
-0
lines changed

3 files changed

+113
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ If you aren't using a debugger (or want to use other debugging configurations),
5555
<details open="open">
5656
<summary><h2 style="display: inline-block" id="installation-of-development-dependencies">Installation of development dependencies</h2></summary>
5757

58+
If you are using Nix, you can use the `devShell` made available in `flake.nix`. Otherwise, you can follow these commands (provided you already have [`Rustup`](https://rustup.rs/) installed):
59+
5860
```sh
5961
rustup target install thumbv6m-none-eabi
6062
cargo install flip-link

flake.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
description = "Flake configuration for my systems";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
6+
utils.url = "github:numtide/flake-utils";
7+
rust-overlay.url = "github:oxalica/rust-overlay";
8+
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
11+
outputs = { nixpkgs, utils, rust-overlay, ... }:
12+
utils.lib.eachDefaultSystem (system:
13+
let pkgs = import nixpkgs { inherit system; overlays = [ (import rust-overlay) ]; };
14+
in {
15+
devShells.default = pkgs.mkShell {
16+
buildInputs = [
17+
pkgs.flip-link
18+
(pkgs.rust-bin.stable.latest.default.override {
19+
extensions = [
20+
"rust-src"
21+
"clippy"
22+
"rust-analyzer"
23+
];
24+
targets = [ "thumbv6m-none-eabi" ];
25+
})
26+
];
27+
};
28+
});
29+
}

0 commit comments

Comments
 (0)