Skip to content

Commit 216688e

Browse files
committed
Add Nix dev shell and direnv support
1 parent 1eca609 commit 216688e

File tree

6 files changed

+115
-0
lines changed

6 files changed

+115
-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
@@ -1 +1,2 @@
11
/target
2+
/.direnv

flake.lock

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

flake.nix

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
4+
5+
fenix = {
6+
url = "github:nix-community/fenix";
7+
inputs.nixpkgs.follows = "nixpkgs";
8+
};
9+
};
10+
11+
outputs = { self, nixpkgs, fenix }:
12+
let
13+
overlays = [ fenix.overlays.default ];
14+
15+
getPkgsFor = (system: import nixpkgs {
16+
inherit system overlays;
17+
});
18+
19+
forEachSystem = func: nixpkgs.lib.genAttrs [
20+
"x86_64-linux"
21+
"aarch64-linux"
22+
23+
"aarch64-darwin"
24+
"x86_64-darwin"
25+
] (system: func (getPkgsFor system));
26+
27+
in {
28+
devShells = forEachSystem (pkgs: {
29+
default = pkgs.callPackage ./shell.nix {};
30+
});
31+
};
32+
}

rust-toolchain.toml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "stable"
3+
profile = "default"
4+
targets = ["x86_64-unknown-linux-gnu", "aarch64-unknown-linux-gnu"]

shell.nix

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{ mkShell, fenix }:
2+
3+
let
4+
toolchain = fenix.fromToolchainFile {
5+
file = ./rust-toolchain.toml;
6+
sha256 = "opUgs6ckUQCyDxcB9Wy51pqhd0MPGHUVbwRKKPGiwZU=";
7+
};
8+
in
9+
10+
mkShell {
11+
packages = [ toolchain ];
12+
}

0 commit comments

Comments
 (0)