Skip to content

Commit

Permalink
Parameterise modules file in mkGoEnv
Browse files Browse the repository at this point in the history
This makes `mkGoEnv` more similar to `buildGoApplication`.

Signed-off-by: Martin Baillie <[email protected]>
  • Loading branch information
martinbaillie committed Sep 26, 2022
1 parent d9ea49c commit 29f6eb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion builder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,11 @@ 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;

Expand Down
3 changes: 2 additions & 1 deletion docs/nix-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -16,6 +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`.

0 comments on commit 29f6eb7

Please sign in to comment.