Haskell implementation of the nix store API
Go to file
2024-11-05 13:31:15 -05:00
.github/workflows ci: update. GHC982, GHC966 only 2024-07-27 19:53:37 +02:00
docs Add danbornside to contributors 2023-12-10 19:22:37 +01:00
hnix-store-core Merge pull request #288 from obsidiansystems/content-address-method-cleanup 2024-11-05 13:31:15 -05:00
hnix-store-db Add new packages to toplevel README 2024-07-31 17:06:46 +02:00
hnix-store-json treewide: update changelogs 2024-07-31 17:06:46 +02:00
hnix-store-nar nar-0.1.0.0 -> nar-0.1.1.0 2024-10-09 14:50:32 +02:00
hnix-store-readonly Further deduplication within makeFixedOutputPath 2024-11-04 17:11:07 -05:00
hnix-store-remote Clean up content address method types 2024-10-31 10:54:12 -04:00
hnix-store-tests Clean up content address method types 2024-10-31 10:54:12 -04:00
.envrc Lorri + direnv. 2019-03-19 20:52:25 -04:00
.gitignore gitignore .ghci(_history), .envrc 2023-11-20 09:22:05 +01:00
cabal.project drop dependent-sum-template source-repository-package, add >= 0.2.0.1 lower bound 2023-12-07 16:35:16 +01:00
cabal.project.local.ci init hnix-store-json 2023-12-07 16:35:16 +01:00
core-simple.png treewide: use lift 2021-08-06 19:29:02 +03:00
default.nix init hnix-store-json 2023-12-07 16:35:16 +01:00
hie.yaml init hnix-store-json 2023-12-07 16:35:16 +01:00
LICENSE Copyright 2018-04-24 09:34:16 -04:00
matrix.nix add matrix.nix for matrix build using all packages and compilers 2023-11-19 11:55:18 +01:00
overlay.nix overlay: dependent-sum-template_0_2_0_1 + jailbreak 2024-07-28 15:51:13 +02:00
README.md Add new packages to toplevel README 2024-07-31 17:06:46 +02:00
shell.nix init hnix-store-json 2023-12-07 16:35:16 +01:00

hnix-store

GitHub Workflow Status

A Haskell interface to the Nix store.

Rationale

Nix can conceptually be broken up into two layers, both (perhaps unfortunately) named "Nix": The expression language and the store. The semantics of the expression language fundamentally depend on the store, but the store is independent of the language. The store semantics provide the basic building blocks of Nix: content-addressed files and directories, the drv file format and the semantics for building drvs, tracking references of store paths, copying files between stores (or to/from caches), distributed builds, etc.

The goal of hnix-store is to provide a Haskell interface to the Nix store semantics, as well as various implementations of that interface. Though the current primary client is hnix, an effort to reimplement the Nix expression language in Haskell, this project is meant to be generic and could be used for a number of other cases of interaction with the Nix store (e.g. a shake backend that emitted each build action as a store derivation). Currently, there are three implementations planned:

  • A mock store which performs no IO whatsoever, for unit testing.
  • A readonly store, which defers to another implementation for readonly effects (such as querying whether some path is valid in the store, or reading a file) but performs mutating effects in-memory only (for example, computing the store path a given directory would live at if added to the store, without actually modifying anything).
  • A remote store, which implements the client side of the Nix daemon Unix domain socket protocol, allowing full interaction with the store on a system with the C++ daemon installed.

Packages

In the interest of separating concerns, this project is split into several Haskell packages.

hnix-store-core

Hackage version Dependencies

Contains the core types and fundamental operations, agnostic to any particular effectful implementation (e.g. in-memory, talking to the Nix daemon in IO, etc.), with the actual implementations in a different package.

The intent is that core business logic for a project that needs to interact with the Nix store can simply depend on hnix-store-core, and only at the very edges of the system would it be necessary to bring in a specific implementation.

hnix-store-db

Hackage version Dependencies

Implementation of the Nix store SQLite database.

hnix-store-json

Hackage version Dependencies

Aeson instances for core types, required for remote store protocol.

hnix-store-nar

Hackage version Dependencies

Packing and unpacking for NAR file format used by Nix.

hnix-store-readonly

Hackage version Dependencies

Path computation without interaction with the actual Nix store

hnix-store-remote

Hackage version Dependencies

Nix worker protocol implementation for interacting with remote Nix store via nix-daemon.

hnix-store-tests

Hackage version Dependencies

Aribtrary instances and utilities for testing.