buildGoModule: Use the env attribute to pass environment variables #359641
buildGoModule: Use the env attribute to pass environment variables #359641ShamrockLee merged 9 commits intoNixOS:masterfrom
env attribute to pass environment variables #359641Conversation
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. |
|
doronbehar
left a comment
There was a problem hiding this comment.
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 |
6005bb4 to
9414936
Compare
|
I rebased and resolved the merge conflict (seemingly caused by the recent treewide formatting). This PR triggers no rebuild or cleanup except for the documentation-related packages, indicating that it works as intended. Do you think we should merge it now? |
|
ofborg-eval reports three new evaluation warnings after this change. (They are the warnings I added against the obsolete way of specifying the This also informs us that the GH-Action-based evaluation currently misses the additional warnings generated after the changes. |
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
69103d3 to
af99530
Compare
|
Rebased onto the top of |
|
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
Should we backport this? |
This PR is backward-incompatible. If it is for the backporting of future PRs, some changes need to be re-implemented on the release branch. Considering the inherent compatibility between the |
Pass all environment variables with
envand instruct users to do so in the Nixpkgs Reference Manual.This is part of the efforts to allow
buildGoModuleto 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 = relaxedsandbox = truenix-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.