add .#nightly devshell
This commit is contained in:
parent
0d8468c71e
commit
e0c444a699
2 changed files with 134 additions and 2 deletions
39
flake.lock
generated
39
flake.lock
generated
|
|
@ -1,5 +1,26 @@
|
||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1774682177,
|
||||||
|
"narHash": "sha256-OVbuJnJLlbHE28eRMudjtA6NXz/ifuXSho79gvh6GHY=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "e0f515387df77b9fdbaaf81e7f866f0365474c18",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773222311,
|
"lastModified": 1773222311,
|
||||||
|
|
@ -18,10 +39,28 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"fenix": "fenix",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1774569884,
|
||||||
|
"narHash": "sha256-E8iWEPzg7OnE0XXXjo75CX7xFauqzJuGZ5wSO9KS8Ek=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "443ddcddd0c73b07b799d052f5ef3b448c2f3508",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1681028828,
|
||||||
|
|
|
||||||
97
flake.nix
97
flake.nix
|
|
@ -4,6 +4,11 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||||
systems.url = "github:nix-systems/default";
|
systems.url = "github:nix-systems/default";
|
||||||
|
|
||||||
|
fenix = {
|
||||||
|
url = "github:nix-community/fenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
|
|
@ -29,8 +34,11 @@
|
||||||
pkgs = mkPkgs system nixpkgs;
|
pkgs = mkPkgs system nixpkgs;
|
||||||
});
|
});
|
||||||
in {
|
in {
|
||||||
overlays.default = self: super: {
|
overlays = {
|
||||||
libclang = super.llvmPackages_21.libclang;
|
default = self: super: {
|
||||||
|
libclang = super.llvmPackages_21.libclang;
|
||||||
|
};
|
||||||
|
fenix = inputs.fenix.overlays.default;
|
||||||
};
|
};
|
||||||
|
|
||||||
devShells = forAllSystems (
|
devShells = forAllSystems (
|
||||||
|
|
@ -107,6 +115,91 @@
|
||||||
|
|
||||||
shellHook = postConfigure;
|
shellHook = postConfigure;
|
||||||
|
|
||||||
|
env = let
|
||||||
|
inherit (llvmPackages) llvm libclang;
|
||||||
|
in {
|
||||||
|
LD_LIBRARY_PATH = builtins.toString (lib.makeLibraryPath buildInputs);
|
||||||
|
LIBCLANG_PATH = "${libclang.lib}/lib";
|
||||||
|
|
||||||
|
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${pkgs.glibc.dev}";
|
||||||
|
|
||||||
|
# `cargo-llvm-cov` reads these environment variables to find these binaries,
|
||||||
|
# which are needed to run the tests
|
||||||
|
LLVM_COV = "${llvm}/bin/llvm-cov";
|
||||||
|
LLVM_PROFDATA = "${llvm}/bin/llvm-profdata";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nightly = let
|
||||||
|
nixForBindings = pkgs.nixVersions.nix_2_32;
|
||||||
|
inherit (pkgs.rustc) llvmPackages;
|
||||||
|
in
|
||||||
|
pkgs.mkShell rec {
|
||||||
|
name = "nixide";
|
||||||
|
shell = "${pkgs.bash}/bin/bash";
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
# packages we need at runtime
|
||||||
|
packages = with pkgs; [
|
||||||
|
llvmPackages.lld
|
||||||
|
lldb
|
||||||
|
(pkgs.fenix.complete.withComponents [
|
||||||
|
"cargo"
|
||||||
|
"clippy"
|
||||||
|
"rust-src"
|
||||||
|
"rustc"
|
||||||
|
"rustfmt"
|
||||||
|
])
|
||||||
|
rust-analyzer-nightly
|
||||||
|
|
||||||
|
# cargo-c
|
||||||
|
# cargo-llvm-cov
|
||||||
|
# cargo-nextest
|
||||||
|
];
|
||||||
|
|
||||||
|
# packages we need at build time
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
glibc.dev
|
||||||
|
nixForBindings.dev
|
||||||
|
|
||||||
|
rustPlatform.bindgenHook
|
||||||
|
];
|
||||||
|
|
||||||
|
# packages we link against
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
stdenv.cc
|
||||||
|
|
||||||
|
nixForBindings
|
||||||
|
];
|
||||||
|
|
||||||
|
# bindgen uses clang to generate bindings, but it doesn't know where to
|
||||||
|
# find our stdenv cc's headers, so when it's gcc, we need to tell it.
|
||||||
|
postConfigure = lib.optionalString pkgs.stdenv.cc.isGNU ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# REF: https://github.com/nixops4/nix-bindings-rust/blob/main/bindgen-gcc.sh
|
||||||
|
# Rust bindgen uses Clang to generate bindings, but that means that it can't
|
||||||
|
# find the "system" or compiler headers when the stdenv compiler is GCC.
|
||||||
|
# This script tells it where to find them.
|
||||||
|
|
||||||
|
echo "Extending BINDGEN_EXTRA_CLANG_ARGS with system include paths..." 2>&1
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="$${BINDGEN_EXTRA_CLANG_ARGS:-}"
|
||||||
|
export BINDGEN_EXTRA_CLANG_ARGS
|
||||||
|
include_paths=$(
|
||||||
|
echo | $NIX_CC_UNWRAPPED -v -E -x c - 2>&1 \
|
||||||
|
| awk '/#include <...> search starts here:/{flag=1;next} \
|
||||||
|
/End of search list./{flag=0} \
|
||||||
|
flag==1 {print $1}'
|
||||||
|
)
|
||||||
|
for path in $include_paths; do
|
||||||
|
echo " - $path" 2>&1
|
||||||
|
BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS -I$path"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
shellHook = postConfigure;
|
||||||
|
|
||||||
env = let
|
env = let
|
||||||
inherit (llvmPackages) llvm libclang;
|
inherit (llvmPackages) llvm libclang;
|
||||||
in {
|
in {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue