# 使用 Homebrew, apt, Nix 安装 hpack

查看 hpack 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:hpack
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install hpack
```

  证据: local Homebrew formula metadata

### Linux

- Debian apt (92%):

```sh
sudo apt install hpack
```

  证据: Debian stable package indexes: hpack from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- Nix (92%):

```sh
nix profile install nixpkgs#hpack
```

  证据: nixpkgs package indexes: hpack from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

## 软件包事实

- **软件包键:** brew:hpack
- **软件包管理器:** Homebrew
- **版本:** 0.39.6
- **来源摘要:** Modern format for Haskell packages
- **主页:** <https://github.com/sol/hpack>
- **仓库:** <https://github.com/sol/hpack>
- **最后更新:** 2026-07-22T03:24:33Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- hpack (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 0.39.6
## 项目历史与用法

hpack is a Haskell packaging tool and package-description format built around `package.yaml`. It generates Cabal files while trying to reduce repetition and make common package metadata less verbose.

### 项目历史

Simon Hengel's hpack appeared on Hackage in April 2015 with version 0.1.0. The project README describes it as a modern alternative to the Cabal package format, guided by three principles: infer obvious information, give users control when needed, and avoid repeating metadata.

hpack developed alongside Cabal rather than replacing it. The executable reads `package.yaml` and renders a `.cabal` file, while its changelog tracks years of Cabal compatibility work: SPDX license handling, generated module behavior, internal libraries, `build-tool-depends`, Cabal version inference, and support for newer GHC and Cabal releases.

### 采用历史

The README documents native `package.yaml` support in Stack and cabal2nix, while Hackage lists reverse dependencies including stack, pantry, cabal2nix, stack2cabal, stack-lib, and stackage2nix. That places hpack in the machinery around Haskell project templates, Stackage snapshots, and Nix conversion.

Homebrew, Hackage, Stackage, and Linux distribution packaging make hpack available both as a Haskell library/program and as a standalone CLI. Its adoption is tied to `package.yaml` becoming a common Haskell project file, especially in Stack-oriented projects.

### 使用方式

Users write package metadata in `package.yaml`. Stack can consume that file directly, cabal2nix supports it natively, and other workflows can run `hpack` to generate the `.cabal` file before building.

hpack also supports practical package-authoring features such as defaults files, globbing, verbatim Cabal fields, generated module controls, common fields, conditionals, executables, tests, benchmarks, and dependency syntax intended to keep package descriptions maintainable.

### 为什么软件包爱好者会关心

hpack is important because it sits at the contested boundary between package metadata as a human-maintained source file and package metadata as generated build-tool input. Package nerds care about that boundary: generated `.cabal` files can reduce repetition, but they also introduce questions about source-of-truth, reproducibility, diffs, and downstream tooling.

Its long changelog is also a miniature history of Haskell packaging pressure points, from SPDX licenses and Cabal version syntax to generated modules and compatibility with Stack, Stackage, Nix, and newer Cabal releases.

### 时间线

- 2015: Hackage records hpack 0.1.0 uploaded by Simon Hengel.
- 0.18.0: The changelog adds command-line input-file handling and executable shorthand.
- 0.29.0: The changelog adds Cabal 2.1/2.2-related rendering and SPDX license handling.
- 0.36.0: The changelog changes `Paths_` module inference for package specs using spec-version 0.36.0 or later.
- 2026: Hackage records hpack 0.39.6, adding top-level `codeberg` support.

### Related projects

- Cabal is the package format and build-tool ecosystem that hpack generates into.
- Stack has built-in support for hpack's `package.yaml` workflow.
- cabal2nix supports `package.yaml` natively, connecting hpack to Nix packaging workflows.
- Stackage-related tools such as pantry, stack2cabal, stack-lib, and stackage2nix appear in Hackage reverse-dependency metadata.

### 来源

- <https://docs.haskellstack.org/en/stable/topics/package_description/>
- <https://formulae.brew.sh/formula/hpack>
- <https://github.com/sol/hpack>
- <https://github.com/sol/hpack/blob/main/CHANGELOG.md>
- <https://hackage.haskell.org/package/hpack>
- <https://hackage.haskell.org/package/hpack-0.1.0>
- <https://hackage.haskell.org/package/hpack-0.39.6>


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals


## Configuration and credential file locations

These source-backed paths show where this package keeps local settings or durable credentials. Automic Vault can use them as review targets for secret scanning, migration, and command approval.


## Configuration files

- Unix: package.yaml
## 其他软件包管理器记录

- Debian apt - hpack - 0.36.1-1+b1: normalized package name match | Debian stable package indexes: hpack from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | alternative format for Haskell packages | https://github.com/sol/hpack#readme
- Nix - hpack: normalized package name match | nixpkgs package indexes: hpack from https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix
- Ubuntu apt - hpack - 0.35.2-1: normalized package name match | Ubuntu 24.04 LTS package indexes: hpack from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | alternative format for Haskell packages | https://github.com/sol/hpack#readme


## Combined YAML source

View the package source record on GitHub. [combined/hpack.yml](https://github.com/mxcl/pkgdb/blob/main/combined/hpack.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated configuration and credential file locations
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
