Commit Graph

46 Commits

Author SHA1 Message Date
Wael Nasreddine
0505253a30
Merge pull request #303217 from deshaw/buildGoModule-setSourceRoot
buildGoModule: propagate setSourceRoot
2024-07-09 15:10:02 -07:00
Yueh-Shun Li
26baea8388 buildGoModule: don't pass buildFlagsArray as file
Store buildFlagsArray as Bash global array variable instead of
creating/sourcing a file containing its declaration.

buildFlagsArray is short enough, and it is not assigned in a sub-shell.
There's no reason to pass it as a file. Storing it as a variable makes
the build more efficient.
2024-06-01 23:29:41 +00:00
Weijia Wang
b4617eb071 Merge branch 'staging-next' into staging 2024-05-03 19:03:51 +02:00
Weijia Wang
a6742256e2
Merge pull request #279391 from katexochen/buildGoModule/deprecate-buildflags
buildGoModule: announce removal of `buildFlags` and `buildFlagsArray`
2024-05-02 12:58:35 +02:00
Elliot Cameron
e6adf1505c buildGoModule: propagate setSourceRoot to goModules
The underlying goModules derivation must have the same source root as
the overall package. sourceRoot is being propagated already, but
setSourceRoot was not. This was surely an oversight.

This is implemented in such a way that it cannot break existing
vendorHashes unless the package is using setSourceRoot already. If
that's the case, then the package is either broken or found a workaround
to do deal with this very issue (e.g. by using `cd path` in an early
phase).

A simple search (`rg setSourceRoot $(rg -l buildGoModule)`) reveals that
no such packages obviously exist in Nixpkgs.
2024-04-29 14:12:26 -04:00
Yueh-Shun Li
8d861e6118 buildGoModule: place GOFLAGS-related warnings around GOFLAGS specification
Avoid "global" warnings that complicates fixed-point arguments support.
2024-04-18 15:14:43 +00:00
Yueh-Shun Li
6500de413a buildGoModule: warn about flags only when using provided buildPhase
Warn about buildFlags and ldflags only when using buildPhase provided by
buildGoModule.

This allows developers to use buildFlags in custom buildPhase.
2024-04-18 15:05:37 +00:00
Yongun Seong
3e28bdc678
buildGoModule: inherit env from main package to goModule derivation 2024-04-14 14:27:44 +09:00
Paul Meyer
dd540970e2 buildGoModule: announce removal of buildFlags
and `buildFlagsArray`
2024-04-12 10:40:35 +02:00
Weijia Wang
cb00e17a14
Merge pull request #299169 from ShamrockLee/go-module-vendorsha256
buildGoModule: Deprecate vendorSha256 with throw
2024-03-28 10:58:18 +01:00
Paul Meyer
63a052eb57 buildGoModule: warn if -trimpath or -mod= is used
in GOFLAGS
2024-03-28 07:57:19 +01:00
Yueh-Shun Li
c9da94beff buildGoModule: Deprecate vendorSha256 with throw
Ignore vendorSha256 when vendorHash is specified.

Throw when vendorHash isn't specified:
- "buildGoModule: Expect vendorHash instead of vendorSha256" when
  vendorSha256 is specified.
- "buildGoModule: vendorHash is missing" otherwise.

`goModules.outputHashAlgo` is specified as null when vendorHash is not
empty, "sha256" otherwise.

Co-authored-by: zowoq <59103226+zowoq@users.noreply.github.com>
2024-03-27 11:19:40 +08:00
Jörg Thalheim
a292058564
Merge pull request #276685 from katexochen/buildGoModule/buildid
buildGoModule: always set `-buildid=` as ldflag
2024-01-14 14:13:16 +01:00
Sergei Trofimovich
a1422a7f8f build-support/go: fix eval of vendorSha256 accesses
Before the change there was no way to poll for presence of
`vendorSha256` attribute:

    $ nix-instantiate --strict --eval --expr 'with import ./. {}; _3mux.vendorSha256 or "no hash"'
       error: attribute 'vendorSha256' missing
          292|     passthru = passthru // { inherit go goModules vendorHash; } // { inherit (args') vendorSha256; };
             |                                                                     ^

After the change the poll happens as expected:

    $ nix-instantiate --strict --eval --expr 'with import ./. {}; _3mux.vendorSha256 or "no hash"'
    "no hash"
2023-12-30 12:03:28 +10:00
Paul Meyer
891a634876 buildGoModule: always set -buildid= as ldflag
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
2023-12-28 09:59:34 +01:00
Aaron Jheng
c3104c4cad buildGoModule: deprecate vendorSha256 attribute 2023-11-14 09:37:22 +01:00
zowoq
9b562802e0 Revert "buildGoModule: set GOPROXY to go default"
This reverts commit 3392d56b72.

Fixed in cbc976a97c
2023-08-22 09:20:22 +10:00
zowoq
3392d56b72 buildGoModule: set GOPROXY to go default 2023-08-02 01:08:27 +10:00
zowoq
86cd7e0948 buildGo{Module,Package}: set GOTOOLCHAIN to local
prevent go from downloading another toolchain
2023-08-02 01:08:27 +10:00
zowoq
41ccfa322e buildGoModule: refactor GO111MODULE 2023-08-02 01:08:27 +10:00
Artturin
7da39a7a9e
treewide .goModules: revert renaming the derivation
This is a workaround to avoid exposing non-reproducible .goModules
At least for now.
https://github.com/NixOS/nixpkgs/pull/242905#issuecomment-1646820126
2023-07-24 08:15:48 +02:00
Artturin
1c29673fcc treewide: go-modules -> goModules
In 787af0f79f
I had to change ${go-modules} to $goModules to allow overrideAttrs to work;
However, env vars cannot contain -, so  i had to change go-modules too.
This in turn broke nix-update because it uses the go-modules attr.

Instead of making nix-update more complicated, make go-modules naming match cargoDeps.

`fd --type f | xargs sd '\bgo-modules\b' 'goModules'`
and revert change to pkgs/applications/misc/dstask/default.nix
and pkgs/servers/http/dave/default.nix
and pkgs/os-specific/darwin/plistwatch/default.nix

release note added
2023-07-14 00:18:06 +03:00
Yueh-Shun Li
aea73adfdd buildGo{Module,Package}: remove input argument "tags"
Unify how ldflags and tags are passed
2023-05-31 07:14:18 +10:00
zowoq
a91f6eba1e buildGoPackage: remove ldflags and with builtins
as done for buildGoModule in abd5dfa013 and 3be02ada9e
2023-05-31 07:14:18 +10:00
zowoq
304940d98e buildGoModule: format
Co-authored-by: Yueh-Shun Li <shamrocklee@posteo.net>
2023-05-30 19:30:06 +10:00
Yueh-Shun Li
1a89cfae1f buildGoModule: simplify go-module attribute structure without rebuild 2023-05-28 07:50:02 +10:00
zowoq
0ba51a51f8 buildGoModule: alias vendorSha256 to vendorHash 2023-05-27 09:19:47 +10:00
figsoda
3be02ada9e buildGoModule: remove unused lambda parameters 2023-05-24 11:58:12 -04:00
figsoda
abd5dfa013 buildGoModule: remove unused with builtins; 2023-05-24 11:56:21 -04:00
Doron Behar
a82c8611ce
buildGoModule: don't inherit build hooks when building go-modules (#225349)
* buildGoModule: don't inherit postBuild hook when building go-modules

This is a slight revert of 5ce647b8bf
(#212800).

Inheriting these hooks in the `.go-modules` derivation can be confusing:
One doesn't expect them to run when generating the fixed output modules
derivation, but only on the main derivation. A `postBuild` hook that
adds some files to $out will cause a very hard to debug issue[1].

This commit adds support for a dedicated `modPostBuild` hook that will
be used only by the derivation building `.go-modules`. Additionally,
`go.section.md` now explains these attributes behavior better.

[1]:
https://discourse.nixos.org/t/cant-update-a-go-package-getting-go-inconsistent-vendoring/27063/6

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2023-04-22 11:08:54 +10:00
github-actions[bot]
fc0616b73d
Merge master into staging-next 2023-04-09 06:01:16 +00:00
zowoq
dc73bd6430 buildGo{Module,Package}: minor cleanup 2023-04-09 12:23:16 +10:00
Ivan Trubach
dcc576176c buildGo{Module,Package}: fix precedence for or operator 2023-03-24 15:45:25 +10:00
github-actions[bot]
d3648def80
Merge staging-next into staging 2023-02-07 00:02:46 +00:00
zowoq
3feeedb5e2 buildGoModule: make the vendor fetcher error if it is empty 2023-02-07 06:23:39 +10:00
zowoq
421acf1022 buildGo{Module,Package}: respect nix hardening flags when setting buildmode 2023-02-07 06:20:57 +10:00
Sandro Jäckel
5ce647b8bf
buildGoModule: forward prePatch, postPatch and postBuild to vendoring
to be more prediactable
2023-01-26 17:08:55 +01:00
Jörg Thalheim
4a94d77712 buildGo{module,package}: do not build with verbose flags
This creates a lot of noise that can hide actual compile errors.
2022-12-04 16:42:53 +01:00
Sandro
5b76f42372
buildGo{Module,Package}: don't run vet linter 2022-08-20 07:37:14 +10:00
zowoq
9a49ca9f9a buildGo{Module,Package}: move to build-support/go 2022-08-07 18:26:01 +10:00
zowoq
621cc6c813 garble: move to development/tools 2022-08-07 18:26:01 +10:00
R. Ryantm
7e39743274 garble: 0.5.1 -> 0.6.0 2022-03-23 06:31:49 +00:00
Colin
66d547dec8
garble: 20200107 -> 0.5.1, switch to go_1_17
This was pretty straightforward, note that go1.17 is explicitly required
by v0.5.1, and one of the tests requires git, so I added it to the
checkInputs.

Also the tests now pass and don't need the mangle, so I removed the
patch. I left the darwin/aarch64 patch in.
2022-01-30 07:42:46 +10:00
Dmitry Kalinkin
7a95bc1b14
garble: mark as broken on darwin 2022-01-03 18:53:54 -05:00
Ivan Babrou
c62662c962 garble: fix aarch64 build 2021-02-20 21:13:46 +10:00
DavHau
599132aff2 garble: init at 2020-01-07 2021-02-19 15:02:15 +07:00