-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
44 lines (39 loc) · 1.17 KB
/
flake.nix
File metadata and controls
44 lines (39 loc) · 1.17 KB
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
{
description = "Minimal Cargo dev shell for ./book subproject";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./book/rust-toolchain.toml;
in
{
devShells.default = pkgs.mkShell {
packages = [
rustToolchain
pkgs.rust-analyzer
pkgs.mdbook
pkgs.mdbook-katex
pkgs.mdbook-toc
];
CARGO_TARGET_DIR = "./book/target";
shellHook = ''
echo "🚀 Rust dev shell for ./book"
export PATH=$HOME/.cargo/bin:$PATH
if [ -d book ]; then
cd book
echo "📁 cwd => $(pwd)"
fi
rustc --version
cargo --version
'';
};
});
}