Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add checks/ folder #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## High-level

* `checks/` for flake checks.
* `devshells/` for devshells.
* `hosts/` for machine configurations.
* `lib/` for Nix functions.
Expand Down Expand Up @@ -208,6 +209,20 @@ To consume a package inside a host from the same flake, `perSystem.self.<pname>`
Takes the "per-system" arguments. On top of this, it also takes a `pname`
argument.

### `checks/<pname>(.nix|/default.nix)`

The `checks/` folder can be populated by packages that will be run when `nix flake checks` is invoked.

The flake checks are also populate by some of the other attributes, like `packages` and `hosts`.

Inputs:

* The [per-system](#per-system) values, plus the `pname` attribute.

Flake outputs:

* `checks.<system>.<pname>` - will contain the package

#### `templates/<name>/`

Use this if you want your project to be initializable using `nix flake init`.
Expand Down
2 changes: 2 additions & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ let
lib.filterAttrs (_: x: x.pkgs.system == system) (inputs.self.darwinConfigurations or { })
)
))
# load checks from the /checks folder. Those take precedence over the others.
(optionalPathAttrs (src + "/checks") (path: importDir path lib.id))
]
++ (lib.optional (inputs.self.lib.tests or { } != { }) {
lib-tests = pkgs.runCommandLocal "lib-tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
Expand Down