Created
October 27, 2023 03:46
-
-
Save shackra/668937e68960201300d1908cf5fc6780 to your computer and use it in GitHub Desktop.
Flake for compiling Rust crates with dependencies on clang
This file contains hidden or 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
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