From 3b382c738f7ec8a197393a350873403b78de594a Mon Sep 17 00:00:00 2001 From: Leonora Tindall Date: Thu, 12 Jan 2023 18:18:20 -0600 Subject: [PATCH] Add nix shell definition --- .envrc | 1 + .gitignore | 1 + shell.nix | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 .envrc create mode 100644 shell.nix diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..4a4726a5c --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use_nix diff --git a/.gitignore b/.gitignore index 9a643953f..00efef8b5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ ui/target ui-sys/target iui/target target +.direnv diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..e995a2445 --- /dev/null +++ b/shell.nix @@ -0,0 +1,36 @@ +with import {}; +clangStdenv.mkDerivation { + name = "iui-nix-shell"; + nativeBuildInputs = with pkgs; [ + cargo + rustc + gtk3 + pkgconfig + ]; + shellHook = '' +export LIBCLANG_PATH="${pkgs.llvmPackages_latest.libclang.lib}/lib"; +export LLVM_CONFIG_PATH="${pkgs.llvm}/bin/llvm-config"; + 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" + } \ + " +''; +}