Commit Graph

16 Commits

Author SHA1 Message Date
Silvan Mosberger
155ae682a5 buildGoModule/buildGoPackage: Introduce ldflags argument
Previously it was not possible to define multiple ldflags, since only
the last definition applies, and there's some quoting issues with
`buildFlagsArray`. With the new `ldflags` argument it's possible to do
this, e.g.

    ldflags = drv.ldflags or [] ++ [
      "-X main.Version=1.0"
    ]

can now properly append a flag without clearing all previous ldflags.
2021-06-05 09:54:36 +10:00
adisbladis
2c593e8e76
buildGoPackage: Respect passing CGO_ENABLED explicitly
This used to work but was broken by 6a27d63a88.
2021-02-24 23:22:19 +01:00
Pavol Rusnak
cf2a67fef3
pkgs/development: stdenv.lib -> lib
this takes care of the following folders in pkgs/development:
* arduino
* chez-modules
* go-packages
* guile-modules
* idris-modules
* perl-modules
* r-modules
* ruby-modules
2021-01-17 19:11:59 +01:00
zowoq
26117ed4b7 buildGo{Module,Package}: remove disabled
This doesn't seem to have been used since pkgs/top-level/go-packages.nix was split up.
2021-01-11 06:00:38 +10:00
zowoq
4e9f7bbf85 buildGo{Package,Module}: set trimpath in GOFLAGS
Also drop removeReferencesTo

`-trimpath` removes all file system paths from the compiled executable,
this should improve reproducibility.
2020-11-18 08:13:34 +10:00
zowoq
23c781a810 buildGoPackage: check/delete vendor 2020-09-08 16:32:39 +10:00
Jörg Thalheim
eab48f5a1b
buildGo{module,package}: also fixup $out/{libexec,lib}
also suppresses errors if those directories are not present
2020-08-28 13:19:11 +01:00
betaboon
b9ac86e752 buildGoPackage: remove references in $out/libexec 2020-07-03 09:21:26 +02:00
zowoq
3f17518490 buildGoPackage: use $out instead of $bin 2020-04-28 20:30:23 +10:00
zowoq
c1facd193e buildGoPackage: remove inactive maintainer 2020-04-26 12:42:58 +10:00
Jörg Thalheim
ff2ea911b3
buildGoPackage: enable strictDeps
In order to improve cross-compilation let's enable strictDeps
and fix what breaks.
2020-03-28 11:46:38 +00:00
Emery Hemingway
0bec813abf buildGoPackage: remove ehmry from maintainers
I no longer write Go and have lost familiarity with the tooling.
2020-03-16 10:14:04 +05:30
Mario Rodas
46abdee40b buildGoPackage: disable module-mode
Go 1.13 slightly changed the behavior GO111MODULE=auto [1], which might
accidentally cause the go command to build the module, for instance in
the checkPhase:

    [GO111MODULE=auto] activates the module-aware mode of the go command
    whenever the current working directory contains, or is below a
    directory containing, a go.mod file — even if the current directory
    is within GOPATH/src.

[1] https://golang.org/doc/go1.13#proxy-vars
2019-12-10 18:50:44 +01:00
Ding Xiang Fei
6a27d63a88 buildGoPackage: enable cross compilation 2019-06-25 14:42:12 +08:00
Matthew Bauer
1f46aaab1b buildGoPackage: keep string context (#63680)
In Nix, each string has a context that it carries of where it
originated. Some functions like filterAttrs modify the context of its
args when doing comparisons. That is important because we use the
string context of “name” to get where a derivation was defined. This
causes some builtins like unsafeGetAttrPos to report incorrectly that
the string was set in lib/attrsets.nix and reporting that as the
source file. Using removeAttrs avoids this problem.

Fixes #63679
2019-06-22 19:07:26 -07:00
Wael M. Nasreddine
a0d835e95d
buildGoPackage: move it under a different path
This change moves buildGoPackage from pkgs/development/go-modules to
pkgs/development/go-packages, so we can have buildGoModule at
pkgs/development/go-modules.
2019-03-13 18:40:24 -07:00