Skip to content

Commit caa6268

Browse files
committed
add nix flake
1 parent 600cbab commit caa6268

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ target
22
node_modules
33
dist
44
dist-js
5+
.direnv

flake.lock

+58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "nixpkgs";
4+
rust-overlay.url = "github:oxalica/rust-overlay";
5+
};
6+
7+
outputs = { self, nixpkgs, rust-overlay }:
8+
let
9+
overlays = [ rust-overlay.overlays.default ];
10+
11+
pkgs = import nixpkgs {
12+
system = "aarch64-darwin";
13+
inherit overlays;
14+
};
15+
pkgsX86 = import nixpkgs {
16+
system = "x86_64-darwin";
17+
inherit overlays;
18+
};
19+
20+
rustToolchainExtensions = [ "rust-src" "rust-analyzer" "clippy" ];
21+
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
22+
targets = [ "aarch64-apple-darwin" ];
23+
extensions = rustToolchainExtensions;
24+
};
25+
rustToolchainX86 = pkgsX86.rust-bin.stable.latest.default.override {
26+
targets = [ "x86_64-apple-darwin" ];
27+
extensions = rustToolchainExtensions;
28+
};
29+
30+
commonPackages = p: with p; [ bacon ];
31+
32+
in {
33+
devShells = {
34+
aarch64-darwin.default = pkgs.mkShellNoCC {
35+
packages = [ rustToolchain ] ++ (commonPackages pkgs);
36+
shellHook = ''
37+
echo "=== 🛠️ DEV SHELL (APPLE SILICON) ==="
38+
'';
39+
};
40+
x86_64-darwin.default = pkgsX86.mkShellNoCC {
41+
packages = [ rustToolchainX86 ] ++ (commonPackages pkgsX86);
42+
shellHook = ''
43+
echo "=== 🛠️ DEV SHELL (APPLE ROSETTA) ==="
44+
'';
45+
};
46+
};
47+
};
48+
}

0 commit comments

Comments
 (0)