Commit graph

26 commits

Author SHA1 Message Date
adisbladis
509b97c288 Build non-development packages in the same way as development packages
The difference in behaviour was unfortunate.

The only downside I can see is that this doesn't allow for mixed
origins in the same package, which probably shouldn't be done anyway.
2022-06-14 08:19:42 +08:00
adisbladis
d404767bec builder: Build internal packages for host plattform 2022-06-14 05:27:43 +08:00
adisbladis
1ffea526a0 Add package generation for non development packages
This makes it possible to generate packages that you do not have a
local checkout for, e.g. running:
`gomod2nix generate --outdir example/ golang.org/x/tools/cmd/stringer`

This will be useful for packaging dependencies that you are not
developing, but just simply packaging.
2022-06-14 05:15:43 +08:00
adisbladis
aae59a6851 Don't set CGO_ENABLED by default
Instead let the compiler decide.
This will result in less cryptic errors.
2022-06-13 20:53:45 +08:00
adisbladis
ade4c20234 Factor out Go version selection from mkGoEnv and add it to buildGoApplication too 2022-06-13 20:53:45 +08:00
adisbladis
908ab2bb87 Precompile internal packages instead of using go run
It shaves off a second or so of wait time per environment.
2022-06-13 20:37:42 +08:00
adisbladis
973b050adf fetcher: Make sure sources are writable before filtering .ds_store 2022-06-13 20:37:42 +08:00
adisbladis
1eb70073c4 Bump dependencies 2022-06-13 20:37:42 +08:00
adisbladis
a4bed25a86 Add mkGoEnv function
This creates an `mkGoEnv` function which takes care of adding the
correct Go package to your development environment and installs
development dependencies from tools.go in a Nix derivation.

The "normal" workflow around Go with tools.go just sticks development
dependencies in $GOBIN which isn't ideal since you have no separation
between projects.
2022-06-13 20:37:42 +08:00
adisbladis
d7830bd5b2 Filter MacOS .DS_Store directories
Now that we're hashing files directly from the Go sources on the host
system we need to avoid these files.

Closes #49.
2022-06-01 01:46:29 +08:00
HuangYi
36bc9ef864
support impure env GOPROXY
which is by go mod download
2022-05-30 11:13:30 +08:00
adisbladis
79d737ec6e Fix passing of Go to buildGoApplication 2022-05-29 16:24:58 +08:00
adisbladis
d831b947fc Fix go.mod parser for repeated replace directives
Constructs such as
```
replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
```

Are perfectly valid and we previously discarded every one but the last of them.
2022-05-29 16:23:37 +08:00
adisbladis
33b65aa13e root: Use new format for building self 2022-05-28 22:56:52 +08:00
adisbladis
44bb5b9495 builder: Use new format for building 2022-05-28 22:56:52 +08:00
HuangYi
7f6bfc93a3
fix another edge case 2022-05-20 16:31:44 +08:00
HuangYi
e54afe9222
fix symlink nested package
- added a test case to demonstrate the fail scenario
2022-05-20 15:54:53 +08:00
HuangYi
c3f885a5b6
fix comments filter 2022-01-10 16:07:26 +08:00
Doron Behar
2428841585 builder: Use stdenv from arguments, not go.stdenv
It allows users to override the builder to use for example
`pkgsStatic.stdenv`.
2021-11-27 10:30:40 +02:00
yihuang
af2ff6eb58
fix regex expression on macos 2021-04-02 10:59:32 +08:00
adisbladis
442b4154e2
Add support for local replace directives
This fixes relative path modules not being correctly vendored by
parsing go.mod in Nix and vendoring them into the correct directory in
the Nix sandbox.

Ideally this should also come with a pluggable source filtering
mechanism and/or maybe use any present gitignore files like
poetry2nix does.

To use this new feature you have to pass a new `pwd` param to
`buildGoApplication` as such:
```
buildGoApplication {
  pname = "foo";
  version = "bar";
  pwd = ./.;
  src = lib.cleanSource ./.;
}
```

Fixes #2
2021-03-29 17:20:50 +02:00
adisbladis
f8ad3b8024
Remove Go vendor check relax patch
This is now in upstream nixpkgs
2021-02-10 15:50:58 +01:00
adisbladis
addf1164e9
Add comment from FreeBSD commit to vendor check patch
I want to port this patch into nixpkgs, and we need a good rationale.
2021-01-12 17:54:15 +01:00
adisbladis
929d740884
Format with nixpkgs-fmt 2020-12-03 16:23:40 +01:00
adisbladis
d331f4fd01
Factor out builder call 2020-10-29 13:26:17 +01:00
adisbladis
956903170b
Split builder into its own directory 2020-10-29 13:26:17 +01:00