@@ -5,9 +5,64 @@ A Haskell interface to the [Nix] store.
5
5
6
6
[ Nix ] : https://nixos.org/nix
7
7
8
+ Rationale
9
+ -----------
10
+
11
+ ` Nix ` can conceptually be broken up into two layers, both (perhaps
12
+ unfortunately) named "Nix": The expression language and the store.
13
+ The semantics of the expression language fundamentally depend on the
14
+ store, but the store is independent of the language. The store
15
+ semantics provide the basic building blocks of ` Nix ` :
16
+ content-addressed files and directories, the drv file format and the
17
+ semantics for building drvs, tracking references of store paths,
18
+ copying files between stores (or to/from caches), distributed builds,
19
+ etc.
20
+
21
+ The goal of ` hnix-store ` is to provide a Haskell interface to the Nix
22
+ store semantics, as well as various implementations of that interface.
23
+ Though the current primary client is [ hnix] , an effort to reimplement
24
+ the ` Nix ` expression language in Haskell, this project is meant to be
25
+ generic and could be used for a number of other cases of interaction
26
+ with the ` Nix ` store (e.g. a ` shake ` backend that emitted each build
27
+ action as a store derivation). Currently, there are three
28
+ implementations planned:
29
+
30
+ * A ` mock ` store which performs no IO whatsoever, for unit testing.
31
+ * A ` readonly ` store, which defers to another implementation for
32
+ readonly effects (such as querying whether some path is valid in the
33
+ store, or reading a file) but performs mutating effects in-memory
34
+ only (for example, computing the store path a given directory would
35
+ live at if added to the store, without actually modifying anything).
36
+ * A ` daemon ` store, which implements the client side of the ` Nix `
37
+ daemon Unix domain socket protocol, allowing full interaction with
38
+ the store on a system with the C++ daemon installed.
39
+
40
+ While this project is in the early stages of development, the ` daemon `
41
+ store can be seen as something of a road map: We want to express and
42
+ implement all of (and only) the useful functionality available to a
43
+ client of the existing daemon protocol.
44
+
45
+ Note that there are currently no plans for hnix-store to include an
46
+ implementation which directly mutates the filesystem and database of
47
+ the ` Nix ` store.
48
+
49
+ [ hnix ] : https://github.com/haskell-nix/hnix
50
+
8
51
Packages
9
52
----------
10
53
11
- * [ hnix-store-core] : Core effects for interacting with the Nix store.
54
+ In the interest of separating concerns, this project is split into
55
+ several Haskell packages. The current expectation is at least one
56
+ package, [ hnix-store-core] , containing the core effect types and
57
+ fundamental operations combining them, agnostic to any particular
58
+ effectful implementation (e.g. in-memory, talking to the Nix daemon in
59
+ IO, etc.), with the actual implementations in a different package.
60
+ Whether each implementation gets its own package or not remains to be
61
+ seen.
62
+
63
+ The intent is that core business logic for a project that needs to
64
+ interact with the ` Nix ` store can simply depend on ` hnix-store-core ` ,
65
+ and only at the very edges of the system would it be necessary to
66
+ bring in a specific implementation.
12
67
13
68
[ hnix-store-core ] : ./hnix-store-core
0 commit comments