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

chore: remove fdb from shell.nix on macos #1424

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
56 changes: 34 additions & 22 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# 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 ]; };

foundationDbShellHook = ''
# Set LIBCLANG_PATH to point directly to the library
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"
'';

# TODO(RVT-4163): FoundationDB Nix is only supported on Linux
isFdbSupported = pkgs.stdenv.isLinux && pkgs.stdenv.hostPlatform.system == "x86_64-linux";
in
pkgs.mkShell {
name = "rivet";
Expand Down Expand Up @@ -47,35 +46,48 @@ in

# FoundationDB
llvmPackages.libclang
fdbPackages.foundationdb71

# Fixes "cannot change locale" warning
glibcLocales
]
++ (
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
]
);
] ++ (
# Use the global variable to check if FoundationDB is supported
pkgs.lib.optionals isFdbSupported [
fdbPackages.foundationdb71
]
) ++ (
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 and FoundationDB
export LD_LIBRARY_PATH="${pkgs.clang}/resource-root/lib:${pkgs.lib.strings.makeLibraryPath [ pkgs.openssl ]}:${pkgs.lib.strings.makeLibraryPath [ pkgs.fdbPackages.foundationdb71 ]}"
export LD_LIBRARY_PATH="${pkgs.clang}/resource-root/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${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.
# tokio_unstable required to build Rivet, so force all cargo
# commands to use this flag.
export RUSTFLAGS="--cfg tokio_unstable"

${foundationDbShellHook}
export LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"

${if isFdbSupported then ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.strings.makeLibraryPath [ pkgs.fdbPackages.foundationdb71 ]}"
'' else ''
# Manually check the FDB version
if [ -z "$(command -v fdbcli)" ]; then
echo "WARNING: FoundationDB CLI is not installed. Please install FoundationDB 7.1."
elif ! fdbcli --version 2>/dev/null | grep -q "FoundationDB CLI 7.1"; then
echo "WARNING: FoundationDB CLI version is incorrect. Please install FoundationDB 7.1."
fi
''}
'';
}
Loading