-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to override stdenv? #70
Comments
The CC is used by |
Before I saw this issue, I made a wrapper derivation to work around the stdenv propagation. I haven't hit an issue yet (but who knows, is this unsafe?).
And then using it like this:
|
I solved this by adding another level of indirection too :) I re-exported rust from this overlay into my own overlay, replacing the propagated dependencies like so:
|
@burdiyan would be great to see a full example of how that snippet fits into overriding stdenv for a rust derivation. in my case i'm trying to get |
@steveej I'm using Nix purely for |
thanks @burdiyan. is the final effect that |
@steveej yes, the final effect is that in my development shell the CC is exposed from my |
Hm I'm failing at applying the solution introduced with #177. I can't create a dev shell that does not override the Apple clang. This is what I'm currently trying:
When I add that to my packages, the path to Note that I don't want to recompile Rust with a different version of clang, but I want to have the system clang still available in my dev shell. |
Then you don't want to "override stdenv", which means exactly the former result. (Though it may not always work because we download binaries) |
I'm trying to use the {
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
llvm = pkgs.llvmPackages_19;
rust-bin = rust-overlay.lib.mkRustBin { } (pkgs // { stdenv = llvm.libcxxStdenv; });
rust-toolchain = rust-bin.stable.latest.default.override {
extensions = [
"rust-analyzer"
"rust-src"
];
};
in
{
devShells.default =
with pkgs;
mkShell.override { stdenv = llvm.libcxxStdenv; } {
nativeBuildInputs = [
# rust
rust-toolchain
# c++
cmake
ninja
(llvm.clang-tools.override { enableLibcxx = true; })
];
};
}
);
} But no matter what I try it doesn't work. It always overrides Removing It's perhaps worth noting that the issue doesn't occur on NixOS. |
I tried to ask for more support here: https://discourse.nixos.org/t/unable-to-build-moltenvk-in-a-nix-shell-using-rust-overlay-on-macos/59658 |
I wonder if it's possible to override
stdenv
when using this overlay?The problem I'm having has to do with the fact that this overlay uses
propagated
buildInputs in various places to propagate cc from stdenv. In the project I'm working on I use different cc, but I'm not able to override cc for this overlay no matter what I try, and it override my own cc version in my nix-shell, and everywhere else I depend on rust from this overlay.Is there any way to override stdenv here?
The text was updated successfully, but these errors were encountered: