Skip to content

Commit

Permalink
fix: add shell nix (#1382)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->
Fixes RVT-3953
## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
MasterPtato committed Nov 21, 2024
1 parent 9457bee commit eaee5a5
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Cross-platform Rust Setup: https://zeroes.dev/p/nix-recipe-for-rust/

let
# Pull new Rust packages
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/9b11a87c0cc54e308fa83aac5b4ee1816d5418a2.tar.gz);

# Overlay package
pkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz";
}) { overlays = [ moz_overlay ]; };
in
pkgs.mkShell {
name = "rivet";

buildInputs = with pkgs; [
# Tools
cloc
curl
docker-client # Standardize client CLI since older clients have breaking changes
git-lfs
jq
openssh # ssh-keygen

python310Packages.detect-secrets

# Compilers
clang
llvm
lld
pkg-config
pkgs.latest.rustChannels.stable.rust

# Libraries
openssl

# Autocomplete
bashInteractive
bash-completion

# Utilities
netcat

# Fixes "cannot change locale" warning
glibcLocales
]
++ extraInputs
++ (
pkgs.lib.optionals stdenv.isDarwin [
libiconv # See https://stackoverflow.com/a/69732679
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.CoreServices
darwin.apple_sdk.frameworks.CoreFoundation
darwin.apple_sdk.frameworks.Foundation
]
);
shellHook = ''
# Setup Git LFS
git lfs install --manual > /dev/null
# Install autocomplete
source ${pkgs.bash-completion}/share/bash-completion/bash_completion
# Fix dynamic library path to fix issue with Python
export LD_LIBRARY_PATH="${pkgs.clang}/resource-root/lib:${pkgs.lib.strings.makeLibraryPath [ pkgs.openssl ]}"
# Set default Rust flags to match the Rust flags used inside of Bolt.
#
# If these don't match, then the build cache is purged any time Rust is ran from Bolt.
export RUSTFLAGS="--cfg tokio_unstable"
'';
}

0 comments on commit eaee5a5

Please sign in to comment.