-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
29 lines (26 loc) · 1.39 KB
/
default.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
{ pkgs ? import <nixpkgs> {} }:
let
nativeBuildInputs = with pkgs; [
rustup openssl pkg-config libiconv
libclang rustPlatform.bindgenHook
libcxx
];
in
pkgs.mkShell {
inherit nativeBuildInputs;
preBuild = ''
export BINDGEN_EXTRA_CLANG_ARGS=''${pkgs.lib.concatStringsSep " " [
"$(cat ${pkgs.stdenv.cc}/nix-support/libc-crt1-cflags)"
"$(cat ${pkgs.stdenv.cc}/nix-support/libc-cflags)"
"$(cat ${pkgs.stdenv.cc}/nix-support/cc-cflags)"
"$(cat ${pkgs.stdenv.cc}/nix-support/libcxx-cxxflags)"
"${pkgs.lib.optionalString pkgs.stdenv.cc.isClang "-idirafter ${pkgs.stdenv.cc.cc}/lib/clang/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/include"}"
"${pkgs.lib.optionalString pkgs.stdenv.cc.isGNU "-isystem ${pkgs.stdenv.cc.cc}/include/c++/${pkgs.lib.getVersion pkgs.stdenv.cc.cc} -isystem ${pkgs.stdenv.cc.cc}/include/c++/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/${pkgs.stdenv.hostPlatform.config} -idirafter ${pkgs.stdenv.cc.cc}/lib/gcc/${pkgs.stdenv.hostPlatform.config}/${pkgs.lib.getVersion pkgs.stdenv.cc.cc}/include"}"
]}
'';
LIBC_INCLUDE_DIR="${pkgs.libclang.lib}/lib/clang/${pkgs.lib.getVersion pkgs.libclang}/include";
LIBCXX_INCLUDE_DIR="${pkgs.libcxx.dev}/include";
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;
}