Skip to content

Commit 7df799d

Browse files
committed
Add rust-toolchain and nix flake.
rust-toolchain will allow us to ensure that everyone developing on the repository is using the same version of rust. Nix flake will provide out-of-the-box development environment for nix users with the right rust version.
1 parent efa0c9e commit 7df799d

File tree

5 files changed

+134
-0
lines changed

5 files changed

+134
-0
lines changed

.envrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# If nix is installed hook into it.
2+
if [ $(which nix) ]
3+
then
4+
use flake
5+
fi
6+
7+
# If nu is the current shell use toolkit.nu
8+
if [ $(echo $SHELL) == $(which nu) ]
9+
then
10+
nu -e "use toolkit.nu"
11+
fi

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44

55
.vscode/*
66
.DS_Store
7+
.direnv

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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
description = "The New Nushell Parser";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
8+
rust-overlay = {
9+
url = "github:oxalica/rust-overlay";
10+
inputs.nixpkgs.follows = "nixpkgs";
11+
};
12+
};
13+
14+
outputs =
15+
{
16+
nixpkgs,
17+
rust-overlay,
18+
flake-utils,
19+
...
20+
}:
21+
flake-utils.lib.eachDefaultSystem (
22+
system:
23+
let
24+
overlays = [ (import rust-overlay) ];
25+
pkgs = import nixpkgs { inherit system overlays; };
26+
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
27+
in
28+
{
29+
devShells.default = pkgs.mkShell {
30+
nativeBuildInputs = [
31+
rustToolchain
32+
pkgs.rust-analyzer
33+
];
34+
};
35+
}
36+
);
37+
}

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
profile = "default"
3+
channel = "1.81.0"

0 commit comments

Comments
 (0)