Skip to main content

nFPM (deb/rpm/apk)

Generate Linux packages using nFPM

Anodizer integrates with nFPM to generate native Linux packages.

Minimal config

crates:
  - name: myapp
    nfpm:
      - package_name: myapp
        formats: [deb, rpm]
        vendor: "My Company"
        homepage: "https://example.com"
        maintainer: "maintainer@example.com"
        description: "My application"
        license: MIT

nFPM config fields

FieldTypeDefaultDescription
package_namestringPackage name
formatslistPackage formats: deb, rpm, apk, archlinux, ipk
vendorstringnonePackage vendor
homepagestringnoneHomepage URL
maintainerstringnoneMaintainer email
descriptionstringnonePackage description
licensestringnoneLicense identifier
bindirstring/usr/binBinary installation directory
file_name_templatestringautoCustom filename template
contentslistnoneAdditional files to include
dependenciesmapnonePackage dependencies keyed by format (e.g., deb: [git])
scriptsobjectnonePre/post install/remove scripts
overridesmapnonePer-format field overrides

File contents

Include additional files in the package:

nfpm:
  - package_name: myapp
    formats: [deb, rpm]
    contents:
      - src: config.example.yaml
        dst: /etc/myapp/config.yaml
        type: config
      - src: myapp.service
        dst: /usr/lib/systemd/system/myapp.service

Install scripts

nfpm:
  - package_name: myapp
    formats: [deb]
    scripts:
      preinstall: scripts/preinstall.sh
      postinstall: scripts/postinstall.sh
      preremove: scripts/preremove.sh
      postremove: scripts/postremove.sh

Full example

crates:
  - name: myapp
    nfpm:
      - package_name: myapp
        formats: [deb, rpm, apk]
        vendor: "My Company"
        homepage: "https://github.com/myorg/myapp"
        maintainer: "team@example.com"
        description: "A fast CLI tool"
        license: MIT
        dependencies:
          deb:
            - git
          rpm:
            - git
        contents:
          - src: config.example.yaml
            dst: /etc/myapp/config.yaml
            type: config
        overrides:
          deb:
            dependencies:
              - git
              - ca-certificates