Skip to content
Closed
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
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"
'';
}