Created
September 3, 2024 15:47
-
-
Save hawkw/9b1725efca95a4eddcb2aec3425e353e to your computer and use it in GitHub Desktop.
linkerd2-proxy nix-shell
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
scope@{ pkgs ? import <nixpkgs> { } }: | |
let locale = "en_US.UTF8"; | |
in with pkgs; | |
buildEnv { | |
name = "linkerd2-proxy-env"; | |
paths = with pkgs; | |
[ | |
git | |
bash | |
direnv | |
binutils | |
stdenv | |
bashInteractive | |
docker | |
cacert | |
gcc | |
cmake | |
rustup | |
pkg-config | |
openssl | |
protobuf | |
docker | |
just | |
shellcheck | |
(glibcLocales.override { locales = [ locale ]; }) | |
] ++ lib.optional stdenv.isDarwin [ Security libiconv ]; | |
buildInputs = [ clang libclang ]; | |
passthru = with pkgs; { | |
PROTOC = "${protobuf}/bin/protoc"; | |
PROTOC_INCLUDE = "${protobuf}/include"; | |
LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; | |
LC_ALL = locale; | |
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; | |
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; | |
CURL_CA_BUNDLE = "${cacert}/etc/ca-bundle.crt"; | |
CARGO_TERM_COLOR = "always"; | |
RUST_BACKTRACE = "full"; | |
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; | |
OPENSSL_DIR = "${openssl.dev}"; | |
OPENSSL_LIB_DIR = "${openssl.out}/lib"; | |
}; | |
} |
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
scope@{ pkgs ? import <nixpkgs> { } }: | |
with pkgs; | |
llvmPackages.stdenv.mkDerivation { | |
name = "linkerd-proxy-shell"; | |
buildInputs = [ | |
git | |
bash | |
direnv | |
binutils | |
stdenv | |
bashInteractive | |
docker | |
cacert | |
cmake | |
rustup | |
pkg-config | |
openssl | |
protobuf | |
docker | |
just | |
shellcheck | |
go | |
(glibcLocales.override { locales = [ locale ]; }) | |
] ++ lib.optional stdenv.isDarwin [ Security libiconv ]; | |
# From: https://github.com/NixOS/nixpkgs/blob/1fab95f5190d087e66a3502481e34e15d62090aa/pkgs/applications/networking/browsers/firefox/common.nix#L247-L253 | |
# Set C flags for Rust's bindgen program. Unlike ordinary C | |
# compilation, bindgen does not invoke $CC directly. Instead it | |
# uses LLVM's libclang. To make sure all necessary flags are | |
# included we need to look in a few places. | |
shellHook = '' | |
export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \ | |
$(< ${stdenv.cc}/nix-support/libc-cflags) \ | |
$(< ${stdenv.cc}/nix-support/cc-cflags) \ | |
$(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \ | |
${ | |
lib.optionalString stdenv.cc.isClang | |
"-idirafter ${stdenv.cc.cc}/lib/clang/${ | |
lib.getVersion stdenv.cc.cc | |
}/include" | |
} \ | |
${ | |
lib.optionalString stdenv.cc.isGNU | |
"-isystem ${stdenv.cc.cc}/include/c++/${ | |
lib.getVersion stdenv.cc.cc | |
} -isystem ${stdenv.cc.cc}/include/c++/${ | |
lib.getVersion stdenv.cc.cc | |
}/${stdenv.hostPlatform.config} -idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${ | |
lib.getVersion stdenv.cc.cc | |
}/include" | |
} \ | |
" | |
''; | |
PROTOC = "${protobuf}/bin/protoc"; | |
PROTOC_INCLUDE = "${protobuf}/include"; | |
LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; | |
LC_ALL = "en_US.UTF-8"; | |
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; | |
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; | |
CURL_CA_BUNDLE = "${cacert}/etc/ca-bundle.crt"; | |
CARGO_TERM_COLOR = "always"; | |
RUST_BACKTRACE = "full"; | |
LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; | |
ASM = "${stdenv.cc}"; | |
OPENSSL_DIR = "${openssl.dev}"; | |
OPENSSL_LIB_DIR = "${openssl.out}/lib"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment