Haskell implementation of the nix store API
Go to file
Anton-Latukha b0725fa107
WIP
A  hie.yaml
M  hnix-store-core/hnix-store-core.cabal
M  hnix-store-core/src/System/Nix/Hash.hs
M  hnix-store-core/src/System/Nix/Internal/Base.hs
M  hnix-store-core/src/System/Nix/Internal/Base32.hs
M  hnix-store-core/src/System/Nix/Internal/Old.hs
M  hnix-store-core/src/System/Nix/Internal/SriHash.hs
M  hnix-store-core/src/System/Nix/Internal/StorePath.hs
D  hnix-store-core/src/System/Nix/Internal/TruncatedHash.1hs
A  hnix-store-core/src/System/Nix/Internal/TruncatedHash.hs
A  hnix-store-core/src/System/Nix/Internal/Uncycle.hs
2021-01-31 16:10:33 +02:00
.github/workflows Declare tasty-discover a testing build tool (#130) 2021-01-19 13:08:32 +02:00
hnix-store-core WIP 2021-01-31 16:10:33 +02:00
hnix-store-remote Declare tasty-discover a testing build tool (#130) 2021-01-19 13:08:32 +02:00
.envrc Lorri + direnv. 2019-03-19 20:52:25 -04:00
.gitignore cabal new gitignores. 2019-03-19 20:44:29 -04:00
cabal.project add cabal.project 2018-07-16 09:12:34 +02:00
default.nix overlay.nix: add nix and which pkgs to remote buildInputs 2020-12-30 14:12:17 +01:00
hie.yaml WIP 2021-01-31 16:10:33 +02:00
LICENSE Copyright 2018-04-24 09:34:16 -04:00
overlay.nix Declare tasty-discover a testing build tool (#130) 2021-01-19 13:08:32 +02:00
README.md README tweaks and pruning 2020-12-30 14:46:26 +01:00
shell.nix Build expressions. 2019-03-09 18:32:01 -05:00

hnix-store

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

Contains the core effect types and fundamental operations combining them, 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-remote

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