don't pin llvm version

This commit is contained in:
do butterflies cry? 2026-04-13 20:22:56 +10:00
parent f6de1d7b20
commit ede05d4cbf
Signed by: cry
GPG key ID: F68745A836CA0412

201
flake.nix
View file

@ -24,7 +24,6 @@
allowUnfree = false; allowUnfree = false;
allowBroken = false; allowBroken = false;
overlays = builtins.attrValues self.overlays or {}; overlays = builtins.attrValues self.overlays or {};
# config.replaceStdenv = {pkgs}: with pkgs; llvmPackages_21.stdenv;
}; };
forAllSystems = f: forAllSystems = f:
@ -36,9 +35,6 @@
}); });
in { in {
overlays = { overlays = {
default = self: super: {
libclang = super.llvmPackages_21.libclang;
};
fenix = inputs.fenix.overlays.default; fenix = inputs.fenix.overlays.default;
}; };
@ -47,129 +43,126 @@
pkgs, pkgs,
lib, lib,
... ...
}: { }: let
default = let nixForBindings = pkgs.nixVersions.nix_2_34;
nixForBindings = pkgs.nixVersions.nix_2_34; inherit (pkgs.rustc) llvmPackages;
inherit (pkgs.rustc) llvmPackages; in {
in default = pkgs.mkShell rec {
pkgs.mkShell rec { name = "nixide";
name = "nixide"; shell = "${pkgs.bash}/bin/bash";
shell = "${pkgs.bash}/bin/bash"; strictDeps = true;
strictDeps = true;
# packages we need at runtime # packages we need at runtime
packages = with pkgs; [ packages = with pkgs; [
rustc rustc
llvmPackages.lld llvmPackages.lld
llvmPackages.lldb llvmPackages.lldb
# lldb # lldb
cargo cargo
cargo-c cargo-c
cargo-llvm-cov cargo-llvm-cov
cargo-nextest cargo-nextest
clang # DEBUG clang
clang-tools # DEBUG clang-tools
libcxx libcxx
rust-analyzer-unwrapped rust-analyzer-unwrapped
(rustfmt.override {asNightly = true;}) (rustfmt.override {asNightly = true;})
clippy clippy
taplo taplo
]; ];
# packages we need at build time # packages we need at build time
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config pkg-config
glibc.dev glibc.dev
nixForBindings.dev nixForBindings.dev
rustPlatform.bindgenHook rustPlatform.bindgenHook
]; ];
# packages we link against # packages we link against
buildInputs = with pkgs; [ buildInputs = [
stdenv.cc # pkgs.stdenv.cc
nixForBindings nixForBindings
]; ];
env = let env = {
inherit (llvmPackages) llvm libclang; LD_LIBRARY_PATH = builtins.toString (lib.makeLibraryPath buildInputs);
in { LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
LD_LIBRARY_PATH = builtins.toString (lib.makeLibraryPath buildInputs);
LIBCLANG_PATH = "${libclang.lib}/lib";
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}"; RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${pkgs.glibc.dev}"; BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${pkgs.glibc.dev}";
# `cargo-llvm-cov` reads these environment variables to find these binaries, # `cargo-llvm-cov` reads these environment variables to find these binaries,
# which are needed to run the tests # which are needed to run the tests
LLVM_COV = "${llvm}/bin/llvm-cov"; LLVM_COV = "${llvmPackages.llvm}/bin/llvm-cov";
LLVM_PROFDATA = "${llvm}/bin/llvm-profdata"; LLVM_PROFDATA = "${llvmPackages.llvm}/bin/llvm-profdata";
};
}; };
};
nightly = let # nightly = let
nixForBindings = pkgs.nixVersions.nix_2_34; # nixForBindings = pkgs.nixVersions.nix_2_34;
inherit (pkgs.rustc) llvmPackages; # inherit (pkgs.rustc) llvmPackages;
in # in
pkgs.mkShell rec { # pkgs.mkShell rec {
name = "nixide"; # name = "nixide";
shell = "${pkgs.bash}/bin/bash"; # shell = "${pkgs.bash}/bin/bash";
strictDeps = true; # strictDeps = true;
# packages we need at runtime # # packages we need at runtime
packages = with pkgs; [ # packages = with pkgs; [
llvmPackages.lld # llvmPackages.lld
lldb # lldb
(pkgs.fenix.complete.withComponents [ # (pkgs.fenix.complete.withComponents [
"cargo" # "cargo"
"clippy" # "clippy"
"rust-src" # "rust-src"
"rustc" # "rustc"
"rustfmt" # "rustfmt"
]) # ])
rust-analyzer-nightly # rust-analyzer-nightly
# cargo-c # # cargo-c
# cargo-llvm-cov # # cargo-llvm-cov
# cargo-nextest # # cargo-nextest
]; # ];
# packages we need at build time # # packages we need at build time
nativeBuildInputs = with pkgs; [ # nativeBuildInputs = with pkgs; [
pkg-config # pkg-config
glibc.dev # glibc.dev
nixForBindings.dev # nixForBindings.dev
rustPlatform.bindgenHook # rustPlatform.bindgenHook
]; # ];
# packages we link against # # packages we link against
buildInputs = with pkgs; [ # buildInputs = with pkgs; [
stdenv.cc # stdenv.cc
nixForBindings # nixForBindings
]; # ];
env = let # env = let
inherit (llvmPackages) llvm libclang; # inherit (llvmPackages) llvm libclang;
in { # in {
LD_LIBRARY_PATH = builtins.toString (lib.makeLibraryPath buildInputs); # LD_LIBRARY_PATH = builtins.toString (lib.makeLibraryPath buildInputs);
LIBCLANG_PATH = "${libclang.lib}/lib"; # LIBCLANG_PATH = "${libclang.lib}/lib";
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}"; # RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${pkgs.glibc.dev}"; # BINDGEN_EXTRA_CLANG_ARGS = "--sysroot=${pkgs.glibc.dev}";
# `cargo-llvm-cov` reads these environment variables to find these binaries, # # `cargo-llvm-cov` reads these environment variables to find these binaries,
# which are needed to run the tests # # which are needed to run the tests
LLVM_COV = "${llvm}/bin/llvm-cov"; # LLVM_COV = "${llvm}/bin/llvm-cov";
LLVM_PROFDATA = "${llvm}/bin/llvm-profdata"; # LLVM_PROFDATA = "${llvm}/bin/llvm-profdata";
}; # };
}; # };
} }
); );
}; };