summaryrefslogtreecommitdiffstats
path: root/pkgs/README.md
blob: 460a3811b1d54df09efb77c5cb3202c2418f68c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Packages built by other languages' tools

How [pkgs/haskell] and [pkgs/rust] find a package's source and its plan,
and why.  A new overlay of the kind (pkgs/LANGUAGE) follows the same
rules.

## Where a package's source comes from

The first that applies:

1. A checkout, ~/sync/src/NAME, where there is one.  It wins over the
   package in hrm, so that a change in a checkout can be deployed right
   away.  Without a package in hrm, the checkout becomes one anyway (an
   automatic package), so an experiment in ~/sync/src can be deployed by
   adding a module to hrm.
2. The source pinned in [sources.json], as delivered to /var/src/NAME.
3. The system's NIX_PATH, if neither.

The same goes for the sources hrm takes as inputs ([legacy.nix]), but for
nixpkgs, which always comes from NIX_PATH.

## Plans

A plan is what a language's tool works out from the project, saved so
that evaluation needn't run the tool (by import from derivation, which
is slow):

- Haskell: the package itself, as cabal2nix makes it.  [pkgs/haskell]
  holds these; a checkout may have its own, cabal.nix.
- Rust: crate2nix's Cargo.json.

A plan lives next to the source it was made for:

- pkgs/rust/NAME/Cargo.json, for the package in hrm;
- ~/sync/src/NAME/Cargo.json or cabal.nix, for a checkout;
- the delivered source's own, <NAME>/Cargo.json, if it has one.

The source's own plan wins: a checkout uses its own, never the one in
hrm.  A missing plan means the tool runs during evaluation: slower, never
wrong.  A stale plan stops evaluation.

A package file in [pkgs/rust] names its source as it is.  The overlay
copies it into the store for the build, leaving Cargo.lock out next to a
Cargo.json, and checks the plan against the source itself.

[plans] says which plans are current, stale, missing or unused, and makes
them again: the Rust plans in hrm, unused ones too, as they apply where
there's no checkout, and the plans in checkouts, never those in delivered
sources.

[legacy.nix]: ../legacy.nix
[pkgs/haskell]: haskell
[pkgs/rust]: rust
[plans]: shell/plans
[sources.json]: ../sources.json