github.com/goreleaser/goreleaser@v1.25.1/www/docs/customization/nix.md (about) 1 # Nixpkgs 2 3 > Since: v1.19 4 5 After releasing to GitHub, GitLab, or Gitea, GoReleaser can generate and publish 6 a _nixpkg_ to a [Nix User Repository][nur]. 7 8 The `nix` section specifies how the pkgs should be created: 9 10 ```yaml 11 # .goreleaser.yaml 12 nix: 13 - # 14 # Name of the recipe 15 # 16 # Default: ProjectName 17 # Templates: allowed 18 name: myproject 19 20 # IDs of the archives to use. 21 # Empty means all IDs. 22 ids: 23 - foo 24 - bar 25 26 # GOAMD64 to specify which amd64 version to use if there are multiple 27 # versions from the build section. 28 # 29 # Default: v1 30 goamd64: v1 31 32 # URL which is determined by the given Token (github, gitlab or gitea). 33 # 34 # Default depends on the client. 35 # Templates: allowed 36 url_template: "https://github.mycompany.com/foo/bar/releases/download/{{ .Tag }}/{{ .ArtifactName }}" 37 38 # Git author used to commit to the repository. 39 commit_author: 40 name: goreleaserbot 41 email: bot@goreleaser.com 42 43 # The project name and current git tag are used in the format string. 44 # 45 # Templates: allowed 46 commit_msg_template: "{{ .ProjectName }}: {{ .Tag }}" 47 48 # Path for the file inside the repository. 49 # 50 # Default: pkgs/<name>/default.nix 51 # Templates: allowed 52 path: pkgs/foo.nix 53 54 # Your app's homepage. 55 # 56 # Templates: allowed 57 homepage: "https://example.com/" 58 59 # Your app's description. 60 # 61 # Templates: allowed 62 description: "Software to create fast and easy drum rolls." 63 64 # License name. 65 license: "mit" 66 67 # Setting this will prevent goreleaser to actually try to commit the updated 68 # package - instead, it will be stored on the dist directory only, 69 # leaving the responsibility of publishing it to the user. 70 # 71 # If set to auto, the release will not be uploaded to the repository 72 # in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 73 # 74 # Templates: allowed 75 skip_upload: true 76 77 # Runtime dependencies of the package. 78 # 79 # Since: v1.20 80 dependencies: 81 - zsh 82 - chromium 83 - name: bash 84 os: linux 85 - name: fish 86 os: darwin 87 88 # Custom install script. 89 # 90 # Default: 'mkdir -p $out/bin; cp -vr $binary $out/bin/$binary', and 91 # `makeWrapper` if `dependencies` were provided. 92 # Templates: allowed 93 install: | 94 mkdir -p $out/bin 95 cp -vr ./foo $out/bin/foo 96 97 # Custom additional install instructions. 98 # This has the advantage of preventing you to rewrite the `install` script 99 # if the defaults work for you. 100 # 101 # Since: v1.20 102 # Templates: allowed 103 extra_install: | 104 installManPage ./manpages/foo.1.gz 105 106 # Custom post_install script. 107 # Could be used to do any additional work after the "install" script 108 # 109 # Templates: allowed 110 post_install: | 111 installShellCompletion ./completions/* 112 113 {% include-markdown "../includes/repository.md" comments=false %} 114 ``` 115 116 !!! tip 117 118 Learn more about the [name template engine](/customization/templates/). 119 120 ## Things not supported 121 122 - Generating packages that compile from source (using `buildGoModule`) 123 - Generating packages when `archives.format` is `binary` 124 125 ## Dependencies 126 127 ### `nix-prefetch-url` 128 129 The `nix-prefetch-url` binary must be available in the `$PATH` for the 130 publishing to work. 131 132 [iss4034]: https://github.com/goreleaser/goreleaser/issues/4034 133 134 ### GitHub Actions 135 136 To publish a package from one repository to another using GitHub Actions, you 137 cannot use the default action token. 138 You must use a separate token with content write privileges for the tap 139 repository. 140 You can check the 141 [resource not accessible by integration](/errors/resource-not-accessible-by-integration/) 142 for more information. 143 144 ## Setting up a NUR 145 146 To set up a Nix User Repository, follow the instructions in their 147 [repository][nur]. 148 149 Then, you'll need to: 150 151 - publish a release with GoReleaser: it should create the package at 152 `./pkgs/{name}/default.nix` or whatever path you set it up to 153 - make sure `./flake.nix` is correct with what you want, especially the 154 `systems` bit 155 - add your package to `./default.nix` 156 - edit your `README.md` removing the template stuff 157 158 That's it! 159 160 [nur]: https://github.com/nix-community/NUR 161 162 {% include-markdown "../includes/prs.md" comments=false %}