Parameterise tools.go

Signed-off-by: Martin Baillie <martin@baillie.id>
This commit is contained in:
Martin Baillie 2022-09-13 10:17:46 +10:00
parent 89cd0675b9
commit d9ea49c898
No known key found for this signature in database
GPG key ID: 2A56EA64591E15E4
2 changed files with 4 additions and 2 deletions

View file

@ -161,6 +161,7 @@ let
mkGoEnv = mkGoEnv =
{ pwd { pwd
, toolsGo ? pwd + "/tools.go"
}@attrs: }@attrs:
let let
goMod = parseGoMod (readFile "${toString pwd}/go.mod"); goMod = parseGoMod (readFile "${toString pwd}/go.mod");
@ -201,11 +202,11 @@ let
export GOSUMDB=off export GOSUMDB=off
export GOPROXY=off export GOPROXY=off
'' + optionalString (pathExists (pwd + "/tools.go")) '' '' + optionalString (pathExists toolsGo) ''
mkdir source mkdir source
cp ${pwd + "/go.mod"} source/go.mod cp ${pwd + "/go.mod"} source/go.mod
cp ${pwd + "/go.sum"} source/go.sum cp ${pwd + "/go.sum"} source/go.sum
cp ${pwd + "/tools.go"} source/tools.go cp ${toolsGo} source/tools.go
cd source cd source
rsync -a -K --ignore-errors ${vendorEnv}/ vendor rsync -a -K --ignore-errors ${vendorEnv}/ vendor

View file

@ -16,5 +16,6 @@ All other arguments are passed verbatim to `stdenv.mkDerivation`.
### mkGoEnv ### mkGoEnv
Arguments: Arguments:
- **pwd** Path to working directory. - **pwd** Path to working directory.
- **toolsGo** Path to `tools.go` (_default: `pwd + "/tools.go"`).
All other arguments are passed verbatim to `stdenv.mkDerivation`. All other arguments are passed verbatim to `stdenv.mkDerivation`.