diff --git a/builder/default.nix b/builder/default.nix index e16c0c0..d500555 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -161,10 +161,12 @@ let mkGoEnv = { pwd + , toolsGo ? pwd + "/tools.go" + , modules ? pwd + "/gomod2nix.toml" }@attrs: let goMod = parseGoMod (readFile "${toString pwd}/go.mod"); - modulesStruct = fromTOML (readFile "${toString pwd}/gomod2nix.toml"); + modulesStruct = fromTOML (readFile modules); go = selectGo attrs goMod; @@ -201,11 +203,11 @@ let export GOSUMDB=off export GOPROXY=off - '' + optionalString (pathExists (pwd + "/tools.go")) '' + '' + optionalString (pathExists toolsGo) '' mkdir source cp ${pwd + "/go.mod"} source/go.mod cp ${pwd + "/go.sum"} source/go.sum - cp ${pwd + "/tools.go"} source/tools.go + cp ${toolsGo} source/tools.go cd source rsync -a -K --ignore-errors ${vendorEnv}/ vendor diff --git a/docs/nix-reference.md b/docs/nix-reference.md index bb4317f..7dffabe 100644 --- a/docs/nix-reference.md +++ b/docs/nix-reference.md @@ -4,7 +4,7 @@ ### buildGoApplication Arguments: -- **modules** Path to gomod2nix.toml (_default: `pwd + "/gomod2nix.toml"`). +- **modules** Path to `gomod2nix.toml` (_default: `pwd + "/gomod2nix.toml"`). - **src** Path to sources (_default: `pwd`). - **pwd** Path to working directory (_default: `null`). - **go** The Go compiler to use (can be omitted). @@ -16,5 +16,7 @@ All other arguments are passed verbatim to `stdenv.mkDerivation`. ### mkGoEnv Arguments: - **pwd** Path to working directory. +- **modules** Path to `gomod2nix.toml` (_default: `pwd + "/gomod2nix.toml"`). +- **toolsGo** Path to `tools.go` (_default: `pwd + "/tools.go"`). All other arguments are passed verbatim to `stdenv.mkDerivation`.