Skip to content

Commit

Permalink
feat: nix support (#4012)
Browse files Browse the repository at this point in the history
very, very, very WIP implementation of nixpkgs for GoReleaser.

**Decisions made for this first version:**
- only linux and darwin, arm64, 386 and amd64
- only support pkgs from goreleaser-generated archives
- no support to push into default nixpkgs repository
- no support to automatically add the _maybe_ new pkg to the root
`default.nix`
- the generated nixpkg will be rather verbose, which shouldn't be too
much of an issue as it is autogenerated anyway

**TODOs**:
- [x] macos universal binary support
- [x] custom pkg path (e.g. pkgs/misc/foo/bar/default.nix)
- [x] handle archives with a folder in them
- [x] add more options: postInstall, ??

**Will be handled in future versions**:
- [ ] archives.format=binary support
- [ ] compile from source
- [ ] PR-ing into nixpkgs
- [ ] armv6l-linux & armv7l-linux support

closes #3537

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed May 26, 2023
1 parent 9d3603a commit 99afc8d
Show file tree
Hide file tree
Showing 30 changed files with 1,934 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ www/docs/static/schema.json linguist-generated=true
www/docs/static/schema-pro.json linguist-generated=true
www/docs/static/releases.json linguist-generated=true
www/docs/static/releases-pro.json linguist-generated=true
*.nix.golden linguist-language=Nix
*.rb.golden linguist-language=Ruby
*.json.golden linguist-language=JSON
*.yaml.golden linguist-language=YAML
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ jobs:
- uses: crazy-max/ghaction-upx@v2
with:
install-only: true
- uses: cachix/install-nix-action@v20
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4
with:
go-version: stable
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ jobs:
- uses: crazy-max/ghaction-upx@v2
with:
install-only: true
- uses: cachix/install-nix-action@v20
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- name: dockerhub-login
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v1
Expand Down
15 changes: 15 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,21 @@ brews:
fish_completion.install "completions/goreleaser.fish"
man1.install "manpages/goreleaser.1.gz"
nix:
- name: goreleaser
repository:
owner: goreleaser
name: nur
homepage: https://goreleaser.com
description: Deliver Go binaries as fast and easily as possible
license: mit
install: |-
mkdir -p $out/bin
cp -vr ./goreleaser $out/bin/goreleaser
installManPage ./manpages/goreleaser.1.gz
installShellCompletion ./completions/*
aurs:
- homepage: https://goreleaser.com
description: Deliver Go binaries as fast and easily as possible
Expand Down
2 changes: 2 additions & 0 deletions internal/artifact/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ const (
UploadableSourceArchive
// BrewTap is an uploadable homebrew tap recipe file.
BrewTap
// Nixpkg is an uploadable nix package.
Nixpkg
// PkgBuild is an Arch Linux AUR PKGBUILD file.
PkgBuild
// SrcInfo is an Arch Linux AUR .SRCINFO file.
Expand Down

0 comments on commit 99afc8d

Please sign in to comment.