Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use nix;
47 changes: 47 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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
(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";
};
}
56 changes: 56 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
scope@{ pkgs ? import <nixpkgs> { } }:

let env = (import ./default.nix scope);
in with pkgs;
mkShell {
name = env.name;

buildInputs = [ (import ./default.nix { inherit pkgs; }) ];

# 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";

OPENSSL_DIR = "${openssl.dev}";
OPENSSL_LIB_DIR = "${openssl.out}/lib";
}