Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ variables:
* `NIXERY_CHANNEL`: The name of a Nix/NixOS channel to use for building
* `NIXERY_PKGS_REPO`: URL of a git repository containing a package set (uses
locally configured SSH/git credentials)
* `NIXERY_DEFAULT_TAG`: rev/ref to use as the default for `latest`/empty
* `NIXERY_PKGS_PATH`: A local filesystem path containing a Nix package set to
use for building
* `NIXERY_STORAGE_BACKEND`: The type of backend storage to use, currently
Expand Down
10 changes: 7 additions & 3 deletions config/pkgsource.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ func (g *GitSource) Render(tag string) (string, string) {
"url": g.repository,
}

// The 'git' source requires a tag to be present. If the user
// has not specified one, it is assumed that 'HEAD' should be used.
// If the user has not specified a non-default tag,
// use $NIXERY_DEFAULT_TAG or HEAD as the tag.
if tag == "latest" || tag == "" {
tag = "HEAD"
if default_tag := os.Getenv("NIXERY_DEFAULT_TAG"); default_tag != "" {
tag = default_tag
} else {
tag = "HEAD"
}
}

if commitRegex.MatchString(tag) {
Expand Down