Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust-toolchain and nix flake #20

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@

.vscode/*
.DS_Store

# Allow everyone to customize .envrc
/.envrc
# Output / cache from direnv
/.direnv
# Output from nix
/result
82 changes: 82 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
# This is a Nix Flake that defines development environment for this project.
#
# Using Nix is NOT required to develop this project.
#
# Nix provides a declariative way to define reproducible development environment
# and aims to remove the issue of "works on my machine".
#
# If you use Nix, you can install and activate all dependencies required to
# develop on this project with:
#
# $ nix develop
#
# If in addition you have `direnv` installed, you can create `.envrc` file with
# `use flake` content, so that development environment activates automatically
# when the project root directory is entered.
#
# More information:
# - Nix: https://nixos.org
# - Nix flakes: https://wiki.nixos.org/wiki/Flakes
# - Direnv: https://direnv.net
description = "The New Nushell Parser";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs =
{
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
(rustToolchain.override {
extensions = [
"rust-src"
"rust-analyzer"
];
})
];
};
}
);
}
1 change: 1 addition & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
# https://rust-lang.github.io/rustup/concepts/profiles.html
profile = "default"
# When updating, it might be necessary to run `nix flake update`.
channel = "1.81.0"