forked from rivet-gg/rivet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.nix
93 lines (79 loc) · 2.83 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Cross-platofrm Rust Setup: https://zeroes.dev/p/nix-recipe-for-rust/
let
# Include most recent Rust builds
moz_overlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/e6ca26fe8b9df914d4567604e426fbc185d9ef3e.tar.gz);
# If you need a newer version of packages, use unstablePkgs.
pkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/23.05.tar.gz";
}) { overlays = [ moz_overlay ]; };
# Bleeding edge packages for those that need to be up to date with the
# latest. We pin this to a specific commit instead of using `master` so
# we're not building environments against a moving target & improves
# reproducability.
unstablePkgs = import (fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/462f4a45aa5f988ae94156fdc9a61b7d3d0f7fbf.tar.gz";
}) { overlays = [ moz_overlay ]; };
custom_clickhouse = import ./infra/nix/pkgs/clickhouse.nix { inherit (pkgs) stdenv fetchurl lib; };
in
pkgs.mkShell {
name = "rivet";
buildInputs = with pkgs; [
# Infrastructure
salt
consul
nomad
terraform
# Tools
cloc
curl
docker-client
git # Bolt relies functionality only available in newer versions of Bolt
rsync
traefik # Used to proxy requests in Bolt
cloudflared
go-migrate
jq
# Databases
postgresql # For psql
custom_clickhouse # For ClickHouse CLI
redis # For the redis-cli
# Runtimes
nodejs-slim # Required for Fern
# Compilers
clang
llvm
lld
pkg-config
pkgs.latest.rustChannels.stable.rust
# Libraries
openssl
protobuf
] ++ (
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 = ''
# Add binaries to path. Prefer debug builds over release builds
# since release builds are usually the default but debug builds are
# used for testing things locally.
export PATH="$PATH:${toString ./target/debug/.}:${toString ./target/release/.}"
# See https://docs.rs/prost-build/0.8.0/prost_build/#sourcing-protoc
export PROTOC="${pkgs.protobuf}/bin/protoc"
export PROTOC_INCLUDE="${pkgs.protobuf}/include"
# TODO: Figure out how to do this under nix
# nomad -autocomplete-install
# consul -autocomplete-install
# terraform -install-autocomplete
# 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"
'';
}