Skip to content

Commit 1fa93d9

Browse files
committed
More complete user interface documentation
1 parent a227284 commit 1fa93d9

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

README.md

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,69 @@
11
# Nixpkgs pkgs/by-name checker
22

3-
This directory implements a program to check the [validity](#validity-checks) of the [`pkgs/by-name` Nixpkgs directory](https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name).
4-
This is part of the implementation of [RFC 140](https://github.com/NixOS/rfcs/pull/140).
3+
This repository implements a program to check [Nixpkgs' `pkgs/by-name` directory](https://github.com/NixOS/nixpkgs/tree/master/pkgs/by-name) as part of [RFC 140](https://github.com/NixOS/rfcs/pull/140).
54

65
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for contributor documentation.
76
Below is the user documentation.
87

9-
To see how it is used in Nixpkgs, see the [`check-by-name.yml` workflow](https://github.com/NixOS/nixpkgs/blob/master/.github/workflows/check-by-name.yml).
8+
Currently the only intended user for this program is [Nixpkgs](https://github.com/NixOS/nixpkgs).
9+
So the interface may be changed in breaking ways as long as Nixpkgs is adjusted to deal with it.
10+
See [the `pkgs/by-name` Readme](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/README.md#validation)
11+
for how it's used in Nixpkgs.
1012

13+
## Nix derivations
1114

12-
## Interface
15+
The source code contains a `default.nix` file, which defines a Nix function.
1316

14-
The interface of the tool is shown with `--help`:
17+
The function takes an attribute set with at least these attributes as its argument:
18+
- `system` (String, defaults to [`builtins.currentSystem`](https://nixos.org/manual/nix/stable/language/builtin-constants.html#builtins-currentSystem)):
19+
The [`system`](https://nixos.org/manual/nix/stable/language/derivations#attr-system)
20+
to build the resulting derivation with.
21+
22+
The function returns an attribute set with at least these attributes:
23+
- `build` ([Package attribute set](https://nixos.org/manual/nix/stable/glossary#package-attribute-set)):
24+
A derivation that can be built with the given `system`.
25+
26+
There is no guarantee that the derivation succeeds on systems that don't have [prebuilt store paths](#prebuilt-store-paths),
27+
but it can be attempted with
28+
29+
```bash
30+
nix-build https://github.com/NixOS/nixpkgs-check-by-name/tarball/master -A build
1531
```
16-
cargo run -- --help
32+
33+
## Prebuilt store paths
34+
35+
The [GitHub releases](https://github.com/NixOS/nixpkgs-check-by-name/releases)
36+
contain a [gzip](https://www.gnu.org/software/gzip/)-compressed
37+
[Nix Archive](https://nixos.org/manual/nix/stable/command-ref/nix-store/export.html)
38+
of the [build closure](https://nixos.org/manual/nix/stable/glossary#gloss-closure)
39+
of the [Nix derivation](#nix-derivation) with `x86_64-linux` as the `system`.
40+
41+
This release artifact is named `x86_64-linux.nar.gz`
42+
and can be imported into a local Nix store using:
43+
44+
```bash
45+
storePath=$(gzip -cd x86_64-linux.nar.gz | nix-store --import | tail -1)
46+
# To prevent it from being garbage-collected
47+
nix-store --realise "$storePath" --add-root result
1748
```
1849

19-
The interface may be changed over time only if the CI workflow making use of it is adjusted to deal with the change appropriately.
50+
Compared to building the [Nix derivations](#nix-derivations),
51+
this has the benefit that no Nix evaluation needs to take place
52+
and is therefore much faster and less storage intensive.
53+
54+
## Binary interface
55+
56+
The store path acquired from the above methods contains
57+
a `system`-specific binary under `$storePath/bin/nixpkgs-check-by-name`.
58+
59+
The public interface of this binary is printed by calling
60+
```bash
61+
result/bin/nixpkgs-check-by-name --help
62+
```
2063

2164
## Validity checks
2265

23-
These checks are performed by this tool:
66+
The following checks are performed when calling the binary:
2467

2568
### File structure checks
2669
- `pkgs/by-name` must only contain subdirectories of the form `${shard}/${name}`, called _package directories_.

0 commit comments

Comments
 (0)