Skip to content

Commit a227284

Browse files
committed
Improve contributor documentation
- Move all that was in README.md to CONTRIBUTING.md README.md is only for user documentation - Expand it to mention recent additions
1 parent ff3553e commit a227284

File tree

2 files changed

+71
-51
lines changed

2 files changed

+71
-51
lines changed

CONTRIBUTING.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Contributor documentation
2+
3+
[@infinisil](https://github.com/infinisil) is the admin and main developer of this repository,
4+
while everybody in [@NixOS/nixpkgs-check-by-name](https://github.com/orgs/NixOS/teams/nixpkgs-check-by-name) has write access.
5+
6+
## Development
7+
8+
Enter the development environment in this directory either automatically with
9+
[`direnv`](https://github.com/direnv/direnv) or manually with
10+
```bash
11+
nix-shell
12+
```
13+
14+
The most important tools and commands in this environment are:
15+
- [rust-analyzer](https://rust-analyzer.github.io/) to have an IDE-like experience for your own editor.
16+
- Running tests:
17+
```bash
18+
cargo test
19+
```
20+
- Linting and formatting:
21+
```bash
22+
cargo clippy --all-targets
23+
treefmt
24+
```
25+
- Running the [main CI checks](./.github/workflows/main.yml) locally:
26+
```bash
27+
nix-build -A ci
28+
```
29+
30+
### Integration tests
31+
32+
Integration tests are declared in [`./tests`](./tests) as subdirectories imitating Nixpkgs with these files:
33+
- `default.nix`:
34+
Always contains
35+
```nix
36+
import <test-nixpkgs> { root = ./.; }
37+
```
38+
which makes
39+
```
40+
nix-instantiate <subdir> --eval -A <attr> --arg overlays <overlays>
41+
```
42+
work very similarly to the real Nixpkgs, just enough for the program to be able to test it.
43+
- `pkgs/by-name`:
44+
The `pkgs/by-name` directory to check.
45+
46+
- `pkgs/top-level/all-packages.nix` (optional):
47+
Contains an overlay of the form
48+
```nix
49+
self: super: {
50+
# ...
51+
}
52+
```
53+
allowing the simulation of package overrides to the real [`pkgs/top-level/all-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix).
54+
The default is an empty overlay.
55+
56+
- `base` (optional):
57+
Contains another subdirectory imitating Nixpkgs with potentially any of the above structures.
58+
This is used to test [ratchet checks](./README.md#ratchet-checks).
59+
60+
- `expected` (optional):
61+
A file containing the expected standard output.
62+
The default is expecting an empty standard output.
63+
64+
## Automation
65+
66+
Pinned dependencies are [regularly updated automatically](./.github/workflows/update.yml).
67+
68+
Releases are [automatically created](./.github/workflows/release.yml) when the `version` field in [`Cargo.toml`](./Cargo.toml)
69+
is updated from a push to the main branch.

README.md

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
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).
44
This is part of the implementation of [RFC 140](https://github.com/NixOS/rfcs/pull/140).
55

6-
This code in this repository was originally [part of Nixpkgs](https://github.com/NixOS/nixpkgs/commits/55bf02190ee57fcf83490fd7b6bf7834e28c9c86/pkgs/test/nixpkgs-check-by-name), but has since been [moved into this separate repository](https://github.com/NixOS/nixpkgs/issues/286559).
6+
See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for contributor documentation.
7+
Below is the user documentation.
78

89
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).
910

10-
[@infinisil](https://github.com/infinisil) is the admin and main developer of this repository, while everybody in [@NixOS/nixpkgs-check-by-name](https://github.com/orgs/NixOS/teams/nixpkgs-check-by-name) has write access.
1111

1212
## Interface
1313

@@ -52,52 +52,3 @@ The current ratchets are:
5252
(see [nix evaluation checks](#nix-evaluation-checks)) must not be introduced.
5353
- New top-level packages defined using `pkgs.callPackage` must be defined with a package directory.
5454
- Once a top-level package uses `pkgs/by-name`, it also can't be moved back out of it.
55-
56-
## Development
57-
58-
Enter the development environment in this directory either automatically with `direnv` or with
59-
```
60-
nix-shell
61-
```
62-
63-
Then use `cargo`:
64-
```
65-
cargo build
66-
cargo test
67-
cargo fmt
68-
cargo clippy
69-
```
70-
71-
## Tests
72-
73-
Tests are declared in [`./tests`](./tests) as subdirectories imitating Nixpkgs with these files:
74-
- `default.nix`:
75-
Always contains
76-
```nix
77-
import <test-nixpkgs> { root = ./.; }
78-
```
79-
which makes
80-
```
81-
nix-instantiate <subdir> --eval -A <attr> --arg overlays <overlays>
82-
```
83-
work very similarly to the real Nixpkgs, just enough for the program to be able to test it.
84-
- `pkgs/by-name`:
85-
The `pkgs/by-name` directory to check.
86-
87-
- `all-packages.nix` (optional):
88-
Contains an overlay of the form
89-
```nix
90-
self: super: {
91-
# ...
92-
}
93-
```
94-
allowing the simulation of package overrides to the real [`pkgs/top-level/all-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix).
95-
The default is an empty overlay.
96-
97-
- `base` (optional):
98-
Contains another subdirectory imitating Nixpkgs with potentially any of the above structures.
99-
This is used for [ratchet checks](#ratchet-checks).
100-
101-
- `expected` (optional):
102-
A file containing the expected standard output.
103-
The default is expecting an empty standard output.

0 commit comments

Comments
 (0)