-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
70 lines (61 loc) · 2.04 KB
/
flake.nix
File metadata and controls
70 lines (61 loc) · 2.04 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
description = "Rust 6502 emulator development environment";
inputs = {
# Stable nixpkgs base + rust-overlay for current stable Rust releases.
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
# Track select fast-moving tools from unstable when needed.
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { nixpkgs, nixpkgs-unstable, flake-utils, rust-overlay, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
pkgsUnstable = import nixpkgs-unstable {
inherit system;
};
lib = pkgs.lib;
# Newer wasm-pack is required than what stable nixpkgs currently provides.
wasmPackPkg = pkgsUnstable.wasm-pack;
# Always tracks the latest stable Rust at your current lockfile revision.
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rustfmt"
"clippy"
"rust-analyzer"
];
targets = [ "wasm32-unknown-unknown" ];
};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
rustToolchain
pkg-config
wasmPackPkg
binaryen
python3
];
buildInputs = with pkgs; [
openssl
ncurses
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
shellHook = ''
echo "🦀 Rust dev shell ready"
echo "rustc: $(rustc --version)"
echo "cargo: $(cargo --version)"
echo "wasm-pack: $(wasm-pack --version)"
'';
};
}
);
}