Skip to content

Instantly share code, notes, and snippets.

@shackra
Created October 27, 2023 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shackra/668937e68960201300d1908cf5fc6780 to your computer and use it in GitHub Desktop.
Save shackra/668937e68960201300d1908cf5fc6780 to your computer and use it in GitHub Desktop.
Flake for compiling Rust crates with dependencies on clang
let
nixpkgs-src = builtins.fetchTarball {
# 23.05
url = "https://github.com/NixOS/nixpkgs/archive/nixos-23.05.tar.gz";
};
pkgs = import nixpkgs-src {
config = {
# allowUnfree may be necessary for some packages, but in general you should not need it.
allowUnfree = false;
};
};
lib-path = with pkgs; lib.makeLibraryPath [ libffi openssl ];
shell = pkgs.mkShell {
buildInputs = [
# other packages needed for compiling python libs
pkgs.readline
pkgs.libffi
pkgs.openssl
pkgs.llvmPackages.libcxxStdenv
pkgs.clang
# unfortunately needed because of messing with LD_LIBRARY_PATH below
pkgs.git
pkgs.openssh
pkgs.rsync
];
shellHook = ''
# Augment the dynamic linker path
export "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${lib-path}"
export "LIBCLANG_PATH=${pkgs.libclang.lib}/lib";
'';
};
in shell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment