Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ericnorris/rules_nfpm
NFPM rules for Bazel
https://github.com/ericnorris/rules_nfpm
bazel bazel-rules deb packager rpm
Last synced: about 1 month ago
JSON representation
NFPM rules for Bazel
- Host: GitHub
- URL: https://github.com/ericnorris/rules_nfpm
- Owner: ericnorris
- License: mit
- Created: 2020-06-11T18:03:57.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T07:58:38.000Z (over 1 year ago)
- Last Synced: 2024-06-21T08:56:02.074Z (7 months ago)
- Topics: bazel, bazel-rules, deb, packager, rpm
- Language: Starlark
- Size: 175 KB
- Stars: 5
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rules_nfpm
`rules_nfpm` provides rules for building 'deb' and 'rpm' packages using [NFPM](https://github.com/goreleaser/nfpm/), a packager written in Go.
While [rules_pkg](https://github.com/bazelbuild/rules_pkg/) _works_, `rules_nfpm` has the following advantages:
- Clear documentation
- No host dependencies (e.g. `rpmbuild` is not needed in `PATH`)
- Built-in templating of Bazel [workspace status](https://docs.bazel.build/versions/master/user-manual.html#workspace_status) key-value pairs## Setup
Include the following snippet in your repository's WORKSPACE file:
```starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")http_archive(
name = "com_github_ericnorris_rules_nfpm",
sha256 = "800ebc64eac94d5ec6589e98a904c8c13aaad1ae0a981550de47a5ad7f72c660",
urls = [
"https://github.com/ericnorris/rules_nfpm/archive/v2.0.0.tar.gz",
],
strip_prefix = "rules_nfpm-2.0.0",
)load("@com_github_ericnorris_rules_nfpm//nfpm:repositories.bzl", "rules_nfpm_dependencies")
rules_nfpm_dependencies()
load("@com_github_ericnorris_rules_nfpm//nfpm:setup.bzl", "rules_nfpm_setup")
rules_nfpm_setup()
load("@com_github_ericnorris_rules_nfpm//nfpm:go_repositories.bzl", "rules_nfpm_go_dependencies")
rules_nfpm_go_dependencies()
```## nfpm_package
nfpm_package(name, config, deps)Generates a package using [NFPM](https://github.com/goreleaser/nfpm/).
The config file is templatized using the `go` [text/template](https://golang.org/pkg/text/template/) library. The dot (`.`) value is a [ConfigTemplateData](https://pkg.go.dev/github.com/ericnorris/rules_nfpm/go/internal/cmd/nfpmwrapper?tab=doc#ConfigTemplateData) struct.
### Example
```starlark
nfpm_package(
name = "helloworld.deb",
config = "helloworld.yaml",
deps = [
"//cmd/helloworld",
],
)
```See the [example directory](/example/README.md) for a more comprehensive example.
**ATTRIBUTES**
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| name | A unique name for this target. | Name | required | |
| config | NFPM configuration file template. | Label | required | |
| deps | Dependencies for this target. The output path of each dependency will be available in the.Dependencies
map in the configuration file template, keyed by the dependency's label. | List of labels | optional | [] |