Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

nova-cache implements the Nix binary cache protocol in Haskell: nix-base32,
NAR serialization (whole-tree and streaming), narinfo parsing, store paths,
Ed25519 signing and upload validation, and an optional WAI cache server.
Ed25519 signing and upload validation, a WAI application for a cache server,
and an optional server executable.
Bounded xz, zstd and bzip2 codecs are the public `nova-cache:xz`,
`nova-cache:zstandard` and `nova-cache:bzip2` sublibraries, and the zstd codec
also compresses for uploads.

Parsing, formatting, hashing, signing and validation are pure. Reading and
writing trees, hashing files, the codecs, the store and the server run in
`IO`. nova-cache is the protocol layer under
Parsing, formatting, hashing, signing, validation, one-shot xz decompression
and zstd compression are pure. Reading and writing trees, hashing files, the
streaming codecs, zstd and bzip2 decompression, the store and the server run
in `IO`. nova-cache is the protocol layer under
[nova-nix](https://github.com/Novavero-AI/nova-nix).

## Installation
Expand Down Expand Up @@ -50,7 +52,8 @@ import NovaCache.Signing (parseSecretKey, sign)
-- Parse a narinfo and sign it
case (parseNarInfo raw, parseSecretKey "mykey:base64...") of
(Right ni, Right sk) -> print (sign sk ni) -- Right "mykey:<base64 sig>"
_ -> error "parse failed"
(Left err, _) -> putStrLn err
(_, Left err) -> putStrLn err
```

```haskell
Expand Down Expand Up @@ -83,9 +86,12 @@ narHash <- withNarSource defaultCaseHack path $ \pull ->
## Server

```bash
cabal run --flag server nova-cache-server -- --port 5000 --store ./nix-cache
CACHE_API_KEY=change-me cabal run --flag server nova-cache-server -- --port 5000 --store ./nix-cache
```

Without `CACHE_API_KEY` the server refuses to start. `--allow-open-writes` runs
it with unauthenticated writes, for local testing only.

The protocol lives in the `NovaCache.Server` library module as a WAI
`Application`, so the cache can be embedded in another server with its own
root page. The bundled executable is one such embedding.
Expand Down Expand Up @@ -164,7 +170,7 @@ Tested with GHC 9.14.1. CI uses the latest cabal-install release.
```bash
cabal update
cabal build all -f server --enable-tests --ghc-options="-Werror"
cabal test -f server --ghc-options="-Werror"
cabal test -f server --enable-tests --ghc-options="-Werror"
```

## License
Expand Down
1 change: 1 addition & 0 deletions changelog.d/readme-current.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **The README in the package describes 0.12: its version bounds, the server's required `CACHE_API_KEY`, and which codecs are pure.** The README in the 0.12.0.0 tarball, the one Hackage shows, gave bounds that exclude 0.12 itself and a server command that exits at once, since the server refuses to start without `CACHE_API_KEY` unless given `--allow-open-writes`. It also called the WAI server optional, where `NovaCache.Server` is always part of the library and only the executable sits behind `-f server`, and counted one-shot xz decompression and zstd compression among the `IO` operations, where both are pure. The test command now passes `--enable-tests`, as CI's does.
12 changes: 5 additions & 7 deletions nova-cache.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,11 @@ library
-Wincomplete-record-updates
-Wincomplete-uni-patterns

-- The bounded xz decoder as a solver-visible opt-in: a consumer that
-- substitutes foreign caches writes build-depends: nova-cache:xz and
-- gets the module; everyone else never builds the xz package's
-- bundled liblzma. This replaces the manual xz flag - a dependency's flag
-- cannot be set from a consumer's .cabal file, which forced mirror
-- flags and matching constraints downstream (nova-nix#27) - while
-- keeping the 0.5.0.0 lesson: xz stays out of the default install.
-- The bounded xz decoder as a public sublibrary: a consumer that
-- substitutes from xz caches depends on nova-cache:xz, and nobody else
-- builds the xz package's bundled liblzma. A sublibrary rather than a
-- flag, because a dependency's flag cannot be set from a consumer's
-- .cabal file.
library xz
visibility: public
exposed-modules: NovaCache.Xz
Expand Down
Loading