-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add flake.nix and rust-toolchain.toml
- Loading branch information
1 parent
41d3066
commit a2a71f9
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
description = "NixOS environment"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
}: let | ||
system = "x86_64-linux"; | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
in { | ||
devShell.${system} = with pkgs; | ||
mkShell { | ||
### | ||
## Executable Packages | ||
### | ||
|
||
buildInputs = with pkgs; [ | ||
clang | ||
# Replace llvmPackages with llvmPackages_X, where X is the latest | ||
# LLVM version (at the time of writing, 16) | ||
llvmPackages_16.bintools | ||
mold | ||
pkg-config | ||
rustup | ||
yq-go | ||
]; | ||
|
||
### | ||
## Rust Toolchain Setup | ||
### | ||
|
||
shellHook = '' | ||
export RUSTC_VERSION=$(yq ".toolchain.channel" rust-toolchain.toml) | ||
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin | ||
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/ | ||
rustup component add rust-analyzer | ||
''; | ||
|
||
### | ||
## Rust Bindgen Setup | ||
### | ||
|
||
# So bindgen can find libclang.so | ||
LIBCLANG_PATH = pkgs.lib.makeLibraryPath [pkgs.llvmPackages_16.libclang.lib]; | ||
# Add headers to bindgen search path | ||
BINDGEN_EXTRA_CLANG_ARGS = | ||
# Includes with normal include path | ||
builtins.map (a: ''-I"${a}/include"'') [ | ||
# add dev libraries here (e.g. pkgs.libvmi.dev) | ||
pkgs.glibc.dev | ||
]; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[toolchain] | ||
profile = "default" | ||
channel = "1.74" |