-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
addAttrsToDerivation seems broken #306953
Comments
Using an older version of nixpkgs (20.09), my MRE works fine without the |
Interesting enough, this does seem to work (on pkgs = import sources.nixpkgs {
config.replaceStdenv = {pkgs}: pkgs.addAttrsToDerivation {
env.NIX_CFLAGS_COMPILE = "-O0";
} pkgs.stdenv;
}; |
I'm also running into the same issue when either applying stdenvAdapters to overlays or crossOverlays:
using them with replaceCrossStdenv:
or changing env directly:
I was able to replicate @allsey87 's success with
so perhaps the issue is in pkgs/stdenv/cross, since it strips config.replaceStdenv, but not overlays? |
I was cross compiling for Emscripten but I have since given up on Nix and started using Bazel |
Usage with In your opening post, the error you saw when using it with Unfortunately, I haven't had time to look your findings, @apt-install-coffee :( |
@allsey87 if we expose
|
Describe the bug
I am trying to use
addAttrsToDerivation
to add some default compilation flags but I think this function is broken. The inline comment suggests the usage should be:Although a quick search through Github, shows most people using it without the
env
beforeNIX_CFLAGS_COMPILE
. In either case the following errors are reported:With
env
:Without
env
Steps To Reproduce
Use nix-build to try and compile GNU hello with an additional compilation flag via an overlay:
Expected behavior
GNU hello builds with the compilation flag
-O0
.Additional context
I think the changes in PR #225787 around how
env
is handled broke bothwithCFlags
andaddAttrsToDerivation
. The issue withwithCFlags
was raised in #225740 and fixed in #225929, however,addAttrsToDerivation
seems to have been overlooked and seems to have the same problem. In fact, both that issue and this issue mention the error message:Notify maintainers
@Artturin
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.The text was updated successfully, but these errors were encountered: