-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
buildGoModule: Use the env
attribute to pass environment variables
#359641
base: master
Are you sure you want to change the base?
Conversation
9665fbe
to
99d7fb6
Compare
|
99d7fb6
to
fa8d231
Compare
Does it maybe make sense to keep Edit: Ah, I see you have plans for |
fa8d231
to
b636782
Compare
It would be easier for now, as you are suggesting. Still, if we plan to convert build helpers to support fixed-point attributes ( |
#359744 is the plan. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ShamrockLee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes to buildGoModule
look pretty good to me. Haven't iterated the packages' specific commits, but I guess they are trivial and should be good to go.
8174878
to
eefacb3
Compare
c752628
to
fb4b7bb
Compare
Regarding the use of environment variables to control the Go compiler, the current implementation of this PR shadows Should we respect users' specifications for all these variables via |
fb4b7bb
to
b3f5a77
Compare
buildGoModule internally shadow the GOOS and GOARCH specification as its arguments. Beside, GOOS and GOARCH inheritance from buildGoModule.go is broken, since buildGoModule.go doesn't exist.
This help Go modules support __structuredAttrs = true. This commit doesn't touch GOFLAGS, which will be handled in subequent changes.
Programmatically prefixing "CGO_ENABLED =" and "CGO_ENABLED=0;" with "env.", but excluding the files * pkgs/build-support/go/module.nix (buildGoModule implementation) * pkgs/development/compilers/go/* (the Go compiler) * pkgs/build-support/docker/tarsum.nix (not using buildGoModule)
This reverts commit e53afdda6e01c4886d58e86c2f84bcccacf4a744.
Tell users to specify environment variables via `env`. Rename the `var-go-CGO_ENABLED` documentation title from `CGO_ENABLED` to `env.CGO_ENABLED` and move the paragraphs under the `ssec-go-environment`.
…v.CGO_ENABLED changes
b3f5a77
to
6005bb4
Compare
Rebased and resolved merge conflicts with #359798. |
Is there a plan to also move nixpkgs/pkgs/build-support/go/build-hook.sh Lines 6 to 20 in 9273a74
(This doesn't handle the current nix-side (I don't have a lot of experience with different variable types in bash, so I might have some misconceptions.) |
It's #359744. The |
Pass all environment variables with
env
and instruct users to do so in the Nixpkgs Reference Manual.This is part of the efforts to allow
buildGoModule
to take__structuredAttrs = true
. This change would only rebuild the documentationand is easy to merge(it turns out to be a tree-wide fix, but fortunately, reviewers can reproduce the tree-wide changes by string substitution). Other significant/mass-rebuilding changes are split away to make reviewing smoother.One may notice that the added code's indentation differs from the surrounding code. That is because the original code is out-of-formatting and indented too much.
These changes should rebuild no packages other than the documentation.
Cc:
@doronbehar @kalbasit @zowoq (people who might be interested in
buildGoModule
)@emilazy @wolfgangwalther (people who might be interested in
__structuredAttrs
)Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.