Commit Graph

89 Commits

Author SHA1 Message Date
zowoq
a2e6ff2cce buildGoModule: require vendorSha256 to be set in packages 2020-06-17 11:07:00 +10:00
Colin L Rice
a0ddea1d6a
go-modules: Add in old modsha256 w/ warning 2020-05-14 07:21:52 +01:00
Colin L Rice
9761128d2d
go-modules: Augment builds w/ vendor src
This is done in response to complaints that the module format is not
human readable. The vendor source blob is flat files and should be
extremely readable.
2020-05-14 07:21:49 +01:00
Jörg Thalheim
060a9227c2
buildGoModule: enable strictDeps
This will improve cross compiling in the long run.
See also https://github.com/NixOS/nixpkgs/pull/82786
2020-03-18 11:29:29 +00:00
Benjamin Hipple
5f77ff6384
buildGoModule: passthru the modSha256 (#82027)
The builder does not technically need the modSha256 of the vendor dir, and even
though we pass it the entire vendor dir it makes sense not to risk having an
accidental dependency on that variable.

However, tools like [nixpkgs-update](https://github.com/ryantm/nixpkgs-update)
need to inspect the `modSha256` of a package in order to be able to update them,
and since this is a real part of the package (describes info about its
dependencies) let's add it to `passthru`.

Specifically, this allows us to run a cmd like `nix eval -f . tflint.modSha256`
to get the current value, which is how the bot finds it to replace with the new
version in the Rust ecosystem.
2020-03-11 09:52:07 +00:00
zimbatm
f373ecec8f buildGoModule: support impure modules (#76532)
When modSha256 is null, disable the nix sandbox instead of using a
fixed-output derivation. This requires the nix-daemon to have
`sandbox = relaxed` set in their config to work properly.

Because the output is (hopefully) deterministic based on the inputs,
this should give a reproducible output. This is useful for development
outside of nixpkgs where re-generating the modSha256 on each mod.sum
changes is cumbersome.

Don't use this in nixpkgs! This is why null is not the default value.
2019-12-28 12:36:42 -08:00
Danylo Hlynskyi
debca548f9
dolt: init at 0.12.0 (#75693)
* dolt: init at 0.12.0

* Update pkgs/servers/sql/dolt/default.nix

Co-Authored-By: robert seaton <robbpseaton@gmail.com>

* fix eval

* Update pkgs/servers/sql/dolt/default.nix

Co-Authored-By: Wael Nasreddine <wael.nasreddine@gmail.com>

* update Go docs as well
2019-12-16 00:58:16 +02:00
Mario Rodas
c5733e7a09
buildGoModule: disable consult the checksum database on build
Since Go 1.13, `GOSUMDB` defaults to "sum.golang.org", to consult the
checksum database of the main module's go.sum.

We already use the default behavior when building `go-modules`, but Go
tries to consult the checksum database again when building the module,
and fails because since it requires `cacert` and `git` which are not
propagated when building the package.
2019-12-01 16:20:00 -05:00
Mario Rodas
589d4ff232
buildGoModule: remove cached lookup results and tiles
Since GO 1.13, the go command caches the lookup results and tiles in
$GOPATH[1], hence making the module directory non-deterministic.

Use the `-f` flag when removing /sumdb, for compatibility with Go 1.12
because in that version does not exists that directory.

[1] https://go.googlesource.com/proposal/+/master/design/25530-sumdb.md#command-client
2019-10-12 12:00:00 -05:00
Bas van Dijk
8d6fbef92a buildGoModule: support overriding the go-modules derivation 2019-07-28 13:28:27 +02:00
Wael Nasreddine
1474220823
buildGoModule: add ./ to all sub-packages (#63936)
When $subPackages has more than one item, the build was failing because
./ was added only to the first subPackage. This commit adds ./ to all
specified subPackages.
2019-06-29 22:22:02 -07:00
John Children
8698c2a7d5 buildGoModule: pre-initialize module cache (#61967)
For some Go projects a go.mod file is included but there are no listed
dependencies. When this is encountered the Go toolchain will not create
a cache folder for downloaded dependencies which causes buildGoModule to
fail.

An example of a project like this that is widely used is:
https://github.com/golang/protobuf

This commit adds a mkdir command to ensure that the directory always
exists so it can be copied and prevent the failure.
2019-05-24 09:10:35 -07:00
Wael Nasreddine
6d7d69ff3e
buildGoModule: remove SSL env vars in favor of cacert in buildInputs (#58071)
cacert already exposes NIX_SSL_CERT_FILE in its setupHook. Fetchers and builders are already setup to use this variable and there's no need to export them manually.
2019-03-21 14:44:03 -07:00
Vladyslav M
832eb2559d buildGoModule: Allow pname attribute (#57787) 2019-03-17 09:29:20 -07:00
Wael M. Nasreddine
28435e47b1
buildGoModule: function for packaging Go modules
The function buildGoModule builds Go programs managed with Go modules. It builds
a Go module through a two phase build:

- An intermediate fetcher derivation. This derivation will be used to
  fetch all of the dependencies of the Go module.
- A final derivation will use the output of the intermediate derivation
  to build the binaries and produce the final output.
2019-03-14 10:31:02 -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
Andrew Dunham
274afc4932 go: build each package single-threaded (#53390)
I noticed that I was seeing the Go compiler build things in parallel even when I'd set `-j1 --cores 1`. It appears that the compiler, by default, uses the number of CPUs that are available to perform a build, while nixpkgs parallelizes at the directory level.

In order to change the fewest assumptions, this explicitly tells the Go compiler to run single-threaded. The flag's documentation is:

```
-p n
	the number of programs, such as build commands or
	test binaries, that can be run in parallel.
	The default is the number of CPUs available.
```

So this should function as expected. Feedback appreciated!
2019-02-07 14:39:53 +00:00
Jörg Thalheim
b4593b4629
buildGoPackage: also support pname
Following python-modules and stdenv.mkDerivation.
Hopefully zero rebuilds.

Motivation: https://github.com/NixOS/nixpkgs/pull/52409
2018-12-18 03:57:54 +01:00
Jörg Thalheim
79b9462468
go_1_11: fix cross compilation 2018-11-24 10:36:57 +00:00
Jörg Thalheim
9564927888
buildGoPackage: remove build-time dependency on parallel (and perl)
xargs is as good as parallel for our job

fixes #50752
2018-11-21 17:45:44 +00:00
Jörg Thalheim
9bbfc6f6e2
buildGoPackage: re-enable GOCACHE
If projects uses go1.11 modules GOCACHE is required.
Also if buildGoPackage is used in a nix-shell setting we don't
want to override GOCACHE to allow incremental builds.
This should be backported to 18.09
2018-10-28 13:51:16 +00:00
Armando Ramirez
7d238e6da8 Allow doCheck config of buildGoPackage 2018-09-10 23:05:23 +00:00
Frederik Rietdijk
f59e6f4037 Merge master into staging 2018-07-26 16:18:53 +02:00
Antoine Eiche
05df6d4f62 goBuildPackage: Add -x to the go build command if NIX_DEBUG >= 1
The -x go option prints all intermediate commands used by the Go
compiler. For instance, this is pretty useful to debug Go LD_FLAGS
because the used linker command is printed.
2018-07-18 09:50:47 +02:00
Antoine Eiche
a8a5bf0496 buildGoPackage: add shellHook attribute 2018-07-17 13:13:57 +02:00
adisbladis
e95f17e272
buildGoPackage: Dont copy sources to $out
Some sources are quite large and they don't seem to offer much value
2018-07-11 20:40:47 +08:00
Piotr Bogdan
d1fad21401 buildGoPackage: use a separator when joining extraSrcPaths together 2018-04-01 17:44:36 +01:00
Jörg Thalheim
aafd5a63ea buildGoPackage: disable go 1.10 cache
This disables annoying error messages that the go cache in /homeless-shelter cannot be created.
2018-02-24 01:57:16 +00:00
Yegor Timoshenko
40702af936
buildGoPackage: fill in meta.homepage 2017-12-20 01:07:14 +00:00
Orivej Desh
0fddfcdd4d
Merge pull request #30350 from alicebob/absdir
go: use absolute dir in getGoDirs()
2017-11-11 01:17:23 +00:00
Kamil Chmielewski
d05b21d7c0 goDeps: support fetchFromGiHub to fetch Go libs
https://github.com/NixOS/nixpkgs/pull/16017#issuecomment-246252087
https://github.com/NixOS/nixpkgs/pull/17254#issuecomment-245297782
2017-11-01 01:28:57 +01:00
Harmen
6cae9e7127 go: use absolute dir in getGoDirs() 2017-10-12 15:46:08 +02:00
Orivej Desh
07d2a5b412 go: update nonfatal build error list 2017-09-28 10:28:20 +00:00
Joachim Schiele
f30dd71a38 go-modules/generic: add missing PATHs to GOPATH when using nix-shell (#26176) 2017-06-01 20:40:21 +02:00
Jörg Thalheim
2a42b45105 Merge pull request #25103 from Hodapp87/google_cloud_print
cloud-print-connector: init at unstable-2017-01-19
2017-05-20 18:23:12 +01:00
Chris Hodapp
cc4f861f82 cloud-print-connector: init at unstable-2017-01-19
This adds a fairly basic build for just the binaries for the Google
Cloud Print CUPS connector (gcp-cups-connector), and gcp-connector-util
to set it up in the first place. In the future I would like to
streamline the configuration more and make gcp-cups-connector a
proper NixOS service - as right now it must be run by hand.
2017-04-30 08:54:54 -04:00
snyh
12f52d234e buildGoPackage: fix preFixup failing
The preFixup is always failed if the target package hasn't any
binary output.
2017-04-16 09:19:58 +08:00
Joachim Fasting
4a12a681ef
go builder: use removeReferencesTo 2017-03-29 00:35:01 +02:00
Shea Levy
d6c3e74425 buildGoModule: share the buildFlagsArray with the parallel subprocesses 2017-03-15 11:00:55 -04:00
Vladimír Čunát
e065861a4f
buildGoPackage: reduce the default meta.platforms
platforms.all makes no sense as go.meta.platforms is smaller.  Discussion:
https://github.com/NixOS/nixpkgs/pull/20923#issuecomment-266763319
2016-12-14 10:26:20 +01:00
zimbatm
cbdc94f2b7 buildGoPackage: remove go version from name (#21111)
As a user installing the program it's not interesting what go version it
was compiled against. Not more interesting than any other potential
dependencies. It also makes it harder to install or update the package.
2016-12-13 11:35:15 +00:00
Franz Pletz
2d934fdffb
buildGoPackage: introduce extraSrcPaths option
This option adds support for including sources from existing gopaths into
the gopath of the package to build.
2016-10-29 05:18:16 +02:00
Kamil Chmielewski
914e0e594c buildGoPackage: deps.json -> deps.nix in NIXON
https://github.com/NixOS/nixpkgs/pull/17254#issuecomment-245295541

* update docs to describe `deps.nix`
* include goDeps in nix-shell GOPATH
* NixOS 16.09 rel notes about replacing goPackages
2016-09-16 00:04:55 +01:00
Tuomas Tynkkynen
9b63aff395 go: Split output order to match new convention 2016-08-31 13:55:40 +03:00
Kamil Chmielewski
da3ddd48e4 buildGoPackage: remove Go deps file libs.json
After #16017 there were a lot
of comments saying that `nix` would be better than `JSON`
for Go packages dependency sets.
As said in https://github.com/NixOS/nixpkgs/pull/16017#issuecomment-229624046

    > Because of the content-addressable store, if two programs have the
    > same dependency it will already result in the same derivation in
    > the
    > store. Git also has compression in the pack files so it won't make
    > much difference to duplicate the dependencies on disk. And finally
    > most users will just use the binary builds so it won't make any
    > differences to them.

This PR removes `libs.json` file and puts all package dependencies in
theirs `deps.json`.
2016-08-11 23:07:09 +02:00
zimbatm
f870d6aeb6 goBuildPackage: export go
This is useful to make sure to use the same version of go in further
derivations.
2016-06-09 16:11:17 +02:00
Kamil Chmielewski
7eb671ebcd no more goPackages 2016-06-09 13:08:00 +02:00
Kamil Chmielewski
fc9bc9eba5 goDeps: support for mercurial repos 2016-06-09 11:22:02 +02:00
Kamil Chmielewski
81f3092e11 Reusing go libs in deis build 2016-06-09 11:21:30 +02:00
Kamil Chmielewski
bf9f60fe74 buildGoPackage: we don't need to build vendored packages 2016-04-07 17:45:20 +02:00