Skip to content

Commit 3cb30f4

Browse files
authored
dendritic (#3)
1 parent 6f6d7e8 commit 3cb30f4

File tree

28 files changed

+508
-206
lines changed

28 files changed

+508
-206
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@ on:
44
branches: [main]
55
jobs:
66
flake-check:
7-
name: nix flake check
7+
strategy:
8+
matrix:
9+
dir: [".", "./templates/success"]
10+
name: flake check ${{matrix.dir}}
811
runs-on: ubuntu-latest
912
steps:
10-
- uses: actions/checkout@v4
1113
- uses: cachix/install-nix-action@v30
12-
- run: nix flake check -L --override-input target path:$PWD/templates/default
13-
- run: nix flake check -L --override-input target path:$PWD/templates/success
14-
- run: |
15-
nix flake check -L --override-input target path:$PWD/templates/failure || touch did-failed
16-
test -f did-failed
17-
- name: self
18-
run: |
19-
git worktree add myself
20-
rm -rf myself/.git
21-
nix flake check -L --override-input target path:$PWD/myself
14+
- run: nix flake check -L github:$GITHUB_REPOSITORY/$GITHUB_SHA --override-input target github:$GITHUB_REPOSITORY/$GITHUB_SHA?dir=${{matrix.dir}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# templates/*/checkmate/flake.lock

README.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,47 @@
1-
# Checkmate - A flake checker (treefmt & nix-unit) for testing other flakes with zero dependencies.
1+
<p align="right">
2+
<a href="https://github.com/sponsors/vic"><img src="https://img.shields.io/badge/sponsor-vic-white?logo=githubsponsors&logoColor=white&labelColor=%23FF0000" alt="Sponsor Vic"/>
3+
</a>
4+
<a href="https://vic.github.io/dendrix/Dendritic-Ecosystem.html#vics-dendritic-libraries"> <img src="https://img.shields.io/badge/Dendritic-Nix-informational?logo=nixos&logoColor=white" alt="Dendritic Nix"/> </a>
5+
<a href="LICENSE"> <img src="https://img.shields.io/github/license/vic/checkmate" alt="License"/> </a>
6+
<a href="https://github.com/vic/checkmate/actions">
7+
<img src="https://github.com/vic/checkmate/actions/workflows/test.yml/badge.svg" alt="CI Status"/> </a>
8+
</p>
29

3-
Checks include:
10+
# Checkmate - A Dendritic flake checker (treefmt & nix-unit) for testing other flakes with zero dependencies.
11+
12+
> `checkmate` and [vic](https://bsky.app/profile/oeiuwq.bsky.social)'s [dendritic libs](https://vic.github.io/dendrix/Dendritic-Ecosystem.html#vics-dendritic-libraries) made for you with Love++ and AI--. If you like my work, consider [sponsoring](https://github.com/sponsors/vic)
13+
14+
### Checks included by default
415

516
- treefmt - nixfmt, deadnix, mdformat, yamlfmt. See `treefmt.nix`.
617

718
- nix-unit - The flake being checked (ie, `inputs.target`) is expected to expose `flakeModules.checkmate`:
819

9-
> See [import-tree](https://github.com/vic/import-tree/blob/main/checks/checkmate.nix) or [example](https://github.com/vic/checkmate/blob/main/example/checkmate.nix)
20+
### Extensible.
21+
22+
Checkmate is a collection of Denritic modules.
23+
24+
### Getting started
1025

1126
```shell
1227
# Generate a new project including github CI action
1328
nix flake new -t github:vic/checkmate
1429
```
1530

31+
### Running flake check locally
32+
33+
```console
34+
nix flake check github:vic/checkmate --override-input target .
35+
```
36+
1637
### Running treefmt on your code
1738

18-
```shell
39+
```console
1940
# formatting your code
20-
nix run path:checkmate#fmt
41+
nix run github:vic/checkmate#fmt --override-input target .
2142

2243
# checking if code is formatted
23-
nix run path:checkmate#fmt -- --ci
24-
```
25-
26-
### Running flake check locally
27-
28-
```shell
29-
nix run path:checkmate
44+
nix run github:vic/checkmate#fmt --override-input target . -- --ci
3045
```
3146

3247
### CI Usage

default.nix

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
1-
{ inputs, ... }:
21
let
3-
checkmate =
4-
inputs.target.flakeModules.checkmate or (
5-
if builtins.pathExists "${inputs.target}/checkmate.nix" then
6-
"${inputs.target}/checkmate.nix"
7-
else
8-
{ }
9-
);
10-
11-
newFlake = inputs.flake-parts.lib.mkFlake { inherit inputs; } {
12-
imports = [
13-
./flakeModule.nix
14-
checkmate
15-
];
2+
rev = "9100a0f";
3+
narHash = "sha256:09m84vsz1py50giyfpx0fpc7a4i0r1xsb54dh0dpdg308lp4p188";
4+
compat = fetchTarball {
5+
url = "https://github.com/edolstra/flake-compat/archive/${rev}.tar.gz";
6+
sha256 = narHash;
167
};
8+
flake = import compat { src = ./.; };
179
in
18-
{
19-
imports = [
20-
./flakeModule.nix
21-
checkmate
22-
];
23-
24-
flake.lib.newFlake = newFlake;
25-
26-
flake.flakeModule = ./flakeModule.nix;
27-
28-
flake.templates.default = {
29-
description = "Sample flake";
30-
path = ./templates/default;
31-
};
32-
}
10+
flake.outputs

flake.lock

Lines changed: 93 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)