A flake checker (treefmt & nix-unit) for testing other flakes with zero dependencies.

dendritic (#3)

authored by oeiuwq.com and committed by

GitHub 3cb30f41 6f6d7e85

+512 -210
+5 -12
.github/workflows/test.yml
··· 4 4 branches: [main] 5 5 jobs: 6 6 flake-check: 7 - name: nix flake check 7 + strategy: 8 + matrix: 9 + dir: [".", "./templates/success"] 10 + name: flake check ${{matrix.dir}} 8 11 runs-on: ubuntu-latest 9 12 steps: 10 - - uses: actions/checkout@v4 11 13 - 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}}
+1
.gitignore
··· 1 + # templates/*/checkmate/flake.lock
+27 -12
README.md
··· 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> 2 9 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 4 15 5 16 - treefmt - nixfmt, deadnix, mdformat, yamlfmt. See `treefmt.nix`. 6 17 7 18 - nix-unit - The flake being checked (ie, `inputs.target`) is expected to expose `flakeModules.checkmate`: 8 19 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 10 25 11 26 ```shell 12 27 # Generate a new project including github CI action 13 28 nix flake new -t github:vic/checkmate 14 29 ``` 15 30 31 + ### Running flake check locally 32 + 33 + ```console 34 + nix flake check github:vic/checkmate --override-input target . 35 + ``` 36 + 16 37 ### Running treefmt on your code 17 38 18 - ```shell 39 + ```console 19 40 # formatting your code 20 - nix run path:checkmate#fmt 41 + nix run github:vic/checkmate#fmt --override-input target . 21 42 22 43 # 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 30 45 ``` 31 46 32 47 ### CI Usage
+7 -29
default.nix
··· 1 - { inputs, ... }: 2 1 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; 16 7 }; 8 + flake = import compat { src = ./.; }; 17 9 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
+93 -41
flake.lock
··· 1 1 { 2 2 "nodes": { 3 + "den": { 4 + "locked": { 5 + "lastModified": 1762754264, 6 + "narHash": "sha256-XS4kabx8lv/b+yzB8qIPSphPoaStm0qF7aQGNMQGnA8=", 7 + "owner": "vic", 8 + "repo": "den", 9 + "rev": "8843a561848d3b60e7a7bf132482f349bccf0607", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "owner": "vic", 14 + "repo": "den", 15 + "type": "github" 16 + } 17 + }, 18 + "flake-aspects": { 19 + "locked": { 20 + "lastModified": 1762465224, 21 + "narHash": "sha256-jfXLTwngKXwFOCVfCupHGcCw/OIpgy5lMYIF8KPfMN8=", 22 + "owner": "vic", 23 + "repo": "flake-aspects", 24 + "rev": "4cbae79bc642311f45c211f9c20d20226544b6f9", 25 + "type": "github" 26 + }, 27 + "original": { 28 + "owner": "vic", 29 + "repo": "flake-aspects", 30 + "type": "github" 31 + } 32 + }, 33 + "flake-file": { 34 + "locked": { 35 + "lastModified": 1762732765, 36 + "narHash": "sha256-sVxN4q4V8jhIAF44aPSMULIJMJ5eG5HtzcQgbr2UEBg=", 37 + "owner": "vic", 38 + "repo": "flake-file", 39 + "rev": "7b037ae446102d3ccc5e23d3c52d5ada8e0fc4f3", 40 + "type": "github" 41 + }, 42 + "original": { 43 + "owner": "vic", 44 + "repo": "flake-file", 45 + "type": "github" 46 + } 47 + }, 3 48 "flake-parts": { 4 49 "inputs": { 5 - "nixpkgs-lib": "nixpkgs-lib" 50 + "nixpkgs-lib": [ 51 + "nixpkgs-lib" 52 + ] 6 53 }, 7 54 "locked": { 8 - "lastModified": 1743550720, 9 - "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", 55 + "lastModified": 1762440070, 56 + "narHash": "sha256-xxdepIcb39UJ94+YydGP221rjnpkDZUlykKuF54PsqI=", 10 57 "owner": "hercules-ci", 11 58 "repo": "flake-parts", 12 - "rev": "c621e8422220273271f52058f618c94e405bb0f5", 59 + "rev": "26d05891e14c88eb4a5d5bee659c0db5afb609d8", 13 60 "type": "github" 14 61 }, 15 62 "original": { ··· 18 65 "type": "github" 19 66 } 20 67 }, 68 + "import-tree": { 69 + "locked": { 70 + "lastModified": 1762327901, 71 + "narHash": "sha256-AJ96FNj50DU0bTyIzAPkPOjCZTHqjURVjok8qoXvmqM=", 72 + "owner": "vic", 73 + "repo": "import-tree", 74 + "rev": "90fa129798be99cde036b78658e89475710966a1", 75 + "type": "github" 76 + }, 77 + "original": { 78 + "owner": "vic", 79 + "repo": "import-tree", 80 + "type": "github" 81 + } 82 + }, 21 83 "nix-github-actions": { 22 84 "inputs": { 23 85 "nixpkgs": [ ··· 26 88 ] 27 89 }, 28 90 "locked": { 29 - "lastModified": 1731952509, 30 - "narHash": "sha256-p4gB3Rhw8R6Ak4eMl8pqjCPOLCZRqaehZxdZ/mbFClM=", 91 + "lastModified": 1737420293, 92 + "narHash": "sha256-F1G5ifvqTpJq7fdkT34e/Jy9VCyzd5XfJ9TO8fHhJWE=", 31 93 "owner": "nix-community", 32 94 "repo": "nix-github-actions", 33 - "rev": "7b5f051df789b6b20d259924d349a9ba3319b226", 95 + "rev": "f4158fa080ef4503c8f4c820967d946c2af31ec9", 34 96 "type": "github" 35 97 }, 36 98 "original": { ··· 51 113 "treefmt-nix": "treefmt-nix" 52 114 }, 53 115 "locked": { 54 - "lastModified": 1741624954, 55 - "narHash": "sha256-VjLS010BEfwuK343Dst08NnQNS8SRtVCDkz1zTsHuvI=", 116 + "lastModified": 1762774186, 117 + "narHash": "sha256-hRADkHjNt41+JUHw2EiSkMaL4owL83g5ZppjYUdF/Dc=", 56 118 "owner": "nix-community", 57 119 "repo": "nix-unit", 58 - "rev": "e9d81f6cffe67681e7c04a967d29f18c2c540af5", 120 + "rev": "1c9ab50554eed0b768f9e5b6f646d63c9673f0f7", 59 121 "type": "github" 60 122 }, 61 123 "original": { ··· 66 128 }, 67 129 "nixpkgs": { 68 130 "locked": { 69 - "lastModified": 1743538100, 70 - "narHash": "sha256-Bl/ynRPIb4CdtbEw3gfJYpKiHmRmrKltXc8zipqpO0o=", 131 + "lastModified": 1762482733, 132 + "narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=", 71 133 "owner": "nixos", 72 134 "repo": "nixpkgs", 73 - "rev": "b9d43b3fe5152d1dc5783a2ba865b2a03388b741", 135 + "rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc", 74 136 "type": "github" 75 137 }, 76 138 "original": { ··· 80 142 "type": "github" 81 143 } 82 144 }, 83 - "nixpkgs-lib": { 84 - "locked": { 85 - "lastModified": 1743296961, 86 - "narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=", 87 - "owner": "nix-community", 88 - "repo": "nixpkgs.lib", 89 - "rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa", 90 - "type": "github" 91 - }, 92 - "original": { 93 - "owner": "nix-community", 94 - "repo": "nixpkgs.lib", 95 - "type": "github" 96 - } 97 - }, 98 145 "root": { 99 146 "inputs": { 147 + "den": "den", 148 + "flake-aspects": "flake-aspects", 149 + "flake-file": "flake-file", 100 150 "flake-parts": "flake-parts", 151 + "import-tree": "import-tree", 101 152 "nix-unit": "nix-unit", 102 153 "nixpkgs": "nixpkgs", 154 + "nixpkgs-lib": [ 155 + "nixpkgs" 156 + ], 103 157 "systems": "systems", 104 158 "target": "target", 105 159 "treefmt-nix": "treefmt-nix_2" ··· 122 176 }, 123 177 "target": { 124 178 "locked": { 125 - "dir": "templates/default", 126 - "lastModified": 1742108305, 127 - "narHash": "sha256-qy4APgoDSe8RylKqm1sGqcMd4tSamJJp+8Ojse6CnRw=", 179 + "lastModified": 1762800004, 180 + "narHash": "sha256-VO8KzRYOgpVx36ZrJgyhKBIqs/LCSt75RVaCYxQv9TY=", 128 181 "owner": "vic", 129 - "repo": "checkmate", 130 - "rev": "634a8a4895ff721ad16facc9e7fb649cc0a4746c", 182 + "repo": "empty-flake", 183 + "rev": "d4e905be37fc824f49a14577a26e6121f59e4f9d", 131 184 "type": "github" 132 185 }, 133 186 "original": { 134 - "dir": "templates/default", 135 187 "owner": "vic", 136 - "repo": "checkmate", 188 + "repo": "empty-flake", 137 189 "type": "github" 138 190 } 139 191 }, ··· 145 197 ] 146 198 }, 147 199 "locked": { 148 - "lastModified": 1733662930, 149 - "narHash": "sha256-9qOp6jNdezzLMxwwXaXZWPXosHbNqno+f7Ii/xftqZ8=", 200 + "lastModified": 1762410071, 201 + "narHash": "sha256-aF5fvoZeoXNPxT0bejFUBXeUjXfHLSL7g+mjR/p5TEg=", 150 202 "owner": "numtide", 151 203 "repo": "treefmt-nix", 152 - "rev": "357cda84af1d74626afb7fb3bc12d6957167cda9", 204 + "rev": "97a30861b13c3731a84e09405414398fbf3e109f", 153 205 "type": "github" 154 206 }, 155 207 "original": { ··· 165 217 ] 166 218 }, 167 219 "locked": { 168 - "lastModified": 1743081648, 169 - "narHash": "sha256-WRAylyYptt6OX5eCEBWyTwOEqEtD6zt33rlUkr6u3cE=", 220 + "lastModified": 1762410071, 221 + "narHash": "sha256-aF5fvoZeoXNPxT0bejFUBXeUjXfHLSL7g+mjR/p5TEg=", 170 222 "owner": "numtide", 171 223 "repo": "treefmt-nix", 172 - "rev": "29a3d7b768c70addce17af0869f6e2bd8f5be4b7", 224 + "rev": "97a30861b13c3731a84e09405414398fbf3e109f", 173 225 "type": "github" 174 226 }, 175 227 "original": {
+55 -13
flake.nix
··· 1 + # DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file. 2 + # Use `nix run .#write-flake` to regenerate it. 1 3 { 2 - inputs = { 3 - # example target flake to be tested 4 - # override with something else. 5 - target.url = "github:vic/checkmate?dir=templates/default"; 6 4 7 - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; 5 + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); 8 6 9 - systems.url = "github:nix-systems/default"; 10 - flake-parts.url = "github:hercules-ci/flake-parts"; 11 - nix-unit.url = "github:nix-community/nix-unit"; 12 - nix-unit.inputs.nixpkgs.follows = "nixpkgs"; 13 - nix-unit.inputs.flake-parts.follows = "flake-parts"; 14 - treefmt-nix.url = "github:numtide/treefmt-nix"; 15 - treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; 7 + inputs = { 8 + den = { 9 + url = "github:vic/den"; 10 + }; 11 + flake-aspects = { 12 + url = "github:vic/flake-aspects"; 13 + }; 14 + flake-file = { 15 + url = "github:vic/flake-file"; 16 + }; 17 + flake-parts = { 18 + inputs = { 19 + nixpkgs-lib = { 20 + follows = "nixpkgs-lib"; 21 + }; 22 + }; 23 + url = "github:hercules-ci/flake-parts"; 24 + }; 25 + import-tree = { 26 + url = "github:vic/import-tree"; 27 + }; 28 + nix-unit = { 29 + inputs = { 30 + flake-parts = { 31 + follows = "flake-parts"; 32 + }; 33 + nixpkgs = { 34 + follows = "nixpkgs"; 35 + }; 36 + }; 37 + url = "github:nix-community/nix-unit"; 38 + }; 39 + nixpkgs = { 40 + url = "github:nixos/nixpkgs/nixpkgs-unstable"; 41 + }; 42 + nixpkgs-lib = { 43 + follows = "nixpkgs"; 44 + }; 45 + systems = { 46 + url = "github:nix-systems/default"; 47 + }; 48 + target = { 49 + url = "github:vic/empty-flake"; 50 + }; 51 + treefmt-nix = { 52 + inputs = { 53 + nixpkgs = { 54 + follows = "nixpkgs"; 55 + }; 56 + }; 57 + url = "github:numtide/treefmt-nix"; 58 + }; 16 59 }; 17 60 18 - outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ./.; 19 61 }
-27
flakeModule.nix
··· 1 - { inputs, ... }: 2 - { 3 - systems = import inputs.systems; 4 - imports = [ 5 - ./tests.nix 6 - ./treefmt.nix 7 - ]; 8 - 9 - perSystem = 10 - { pkgs, self', ... }: 11 - { 12 - packages.fmt = self'.formatter; 13 - 14 - packages.default = pkgs.writeShellApplication { 15 - name = "flake-check"; 16 - text = '' 17 - ( 18 - if test -f checkmate/flake.nix; then 19 - cd checkmate 20 - fi 21 - nix flake update target 22 - nix flake check 23 - ) 24 - ''; 25 - }; 26 - }; 27 - }
+17
modules/checkmate/imports.nix
··· 1 + { inputs, ... }: 2 + let 3 + 4 + im = 5 + sub: 6 + let 7 + path = "${inputs.target}/${sub}"; 8 + in 9 + if builtins.pathExists path then inputs.import-tree path else { }; 10 + 11 + in 12 + { 13 + imports = [ 14 + (im "checkmate.nix") 15 + (im "checkmate/modules") 16 + ]; 17 + }
+29
modules/checkmate/inputs.nix
··· 1 + { 2 + inputs, 3 + lib, 4 + ... 5 + }: 6 + { 7 + 8 + flake-file.inputs = { 9 + flake-file.url = lib.mkDefault "github:vic/flake-file"; 10 + 11 + nix-unit = { 12 + url = lib.mkDefault "github:nix-community/nix-unit"; 13 + inputs.nixpkgs.follows = lib.mkDefault "nixpkgs"; 14 + inputs.flake-parts.follows = lib.mkDefault "flake-parts"; 15 + }; 16 + 17 + treefmt-nix = { 18 + url = lib.mkDefault "github:numtide/treefmt-nix"; 19 + inputs.nixpkgs.follows = lib.mkDefault "nixpkgs"; 20 + }; 21 + }; 22 + 23 + imports = [ 24 + (inputs.flake-file.flakeModules.dendritic or { }) 25 + (inputs.nix-unit.modules.flake.default or { }) 26 + (inputs.treefmt-nix.flakeModule or { }) 27 + ]; 28 + 29 + }
+31
modules/checkmate/treefmt.nix
··· 1 + { inputs, ... }: 2 + { 3 + perSystem = 4 + { self', lib, ... }: 5 + { 6 + packages.fmt = self'.formatter; 7 + treefmt = { 8 + projectRoot = inputs.target; 9 + projectRootFile = "flake.nix"; 10 + programs = { 11 + mdformat.enable = lib.mkDefault true; 12 + yamlfmt.enable = lib.mkDefault true; 13 + nixfmt.enable = lib.mkDefault true; 14 + deadnix.enable = lib.mkDefault true; 15 + nixf-diagnose.enable = lib.mkDefault true; 16 + prettier.enable = lib.mkDefault true; 17 + }; 18 + settings.on-unmatched = lib.mkDefault "fatal"; 19 + settings.global.excludes = [ 20 + "LICENSE" 21 + "flake.lock" 22 + "*/flake.lock" 23 + ".envrc" 24 + ".direnv/*" 25 + "*/.gitignore" 26 + ".github/ISSUE_TEMPLATE/*" 27 + ]; 28 + }; 29 + }; 30 + 31 + }
+8
modules/outputs.nix
··· 1 + { ... }: 2 + { 3 + flake-file.inputs.target.url = "github:vic/empty-flake"; 4 + flake.templates.default = { 5 + description = "Success flake"; 6 + path = ../templates/success; 7 + }; 8 + }
templates/default/.github/workflows/test.yml templates/success/.github/workflows/test.yml
-12
templates/default/checkmate.nix
··· 1 - { inputs, ... }: 2 - let 3 - self = inputs.target; 4 - in 5 - { 6 - perSystem.nix-unit.tests = { 7 - "test something" = { 8 - expr = self.lib.dup 33; 9 - expected = 66; 10 - }; 11 - }; 12 - }
-1
templates/default/checkmate/.gitignore
··· 1 - flake.lock
-6
templates/default/checkmate/flake.nix
··· 1 - { 2 - inputs.target.url = "path:.."; 3 - inputs.checkmate.url = "github:vic/checkmate"; 4 - inputs.checkmate.inputs.target.follows = "target"; 5 - outputs = inputs: inputs.checkmate.lib.newFlake; 6 - }
-5
templates/default/flake.nix
··· 1 - { 2 - outputs = _: { 3 - lib.dup = x: x * 2; 4 - }; 5 - }
+157
templates/dendritic/checkmate/flake.lock
··· 1 + { 2 + "nodes": { 3 + "checkmate-modules": { 4 + "flake": false, 5 + "locked": { 6 + "lastModified": 1762807089, 7 + "narHash": "sha256-vnj84gFrJzIOdcQhp3A60mk9edDWg4f7uDax3H6LlZg=", 8 + "path": "/home/vic/hk/checkmate/modules/checkmate", 9 + "type": "path" 10 + }, 11 + "original": { 12 + "path": "/home/vic/hk/checkmate/modules/checkmate", 13 + "type": "path" 14 + } 15 + }, 16 + "den": { 17 + "locked": { 18 + "lastModified": 1762754264, 19 + "narHash": "sha256-XS4kabx8lv/b+yzB8qIPSphPoaStm0qF7aQGNMQGnA8=", 20 + "owner": "vic", 21 + "repo": "den", 22 + "rev": "8843a561848d3b60e7a7bf132482f349bccf0607", 23 + "type": "github" 24 + }, 25 + "original": { 26 + "owner": "vic", 27 + "repo": "den", 28 + "type": "github" 29 + } 30 + }, 31 + "flake-aspects": { 32 + "locked": { 33 + "lastModified": 1762465224, 34 + "narHash": "sha256-jfXLTwngKXwFOCVfCupHGcCw/OIpgy5lMYIF8KPfMN8=", 35 + "owner": "vic", 36 + "repo": "flake-aspects", 37 + "rev": "4cbae79bc642311f45c211f9c20d20226544b6f9", 38 + "type": "github" 39 + }, 40 + "original": { 41 + "owner": "vic", 42 + "repo": "flake-aspects", 43 + "type": "github" 44 + } 45 + }, 46 + "flake-file": { 47 + "locked": { 48 + "lastModified": 1762732765, 49 + "narHash": "sha256-sVxN4q4V8jhIAF44aPSMULIJMJ5eG5HtzcQgbr2UEBg=", 50 + "owner": "vic", 51 + "repo": "flake-file", 52 + "rev": "7b037ae446102d3ccc5e23d3c52d5ada8e0fc4f3", 53 + "type": "github" 54 + }, 55 + "original": { 56 + "owner": "vic", 57 + "repo": "flake-file", 58 + "type": "github" 59 + } 60 + }, 61 + "flake-parts": { 62 + "inputs": { 63 + "nixpkgs-lib": [ 64 + "nixpkgs-lib" 65 + ] 66 + }, 67 + "locked": { 68 + "lastModified": 1762810396, 69 + "narHash": "sha256-dxFVgQPG+R72dkhXTtqUm7KpxElw3u6E+YlQ2WaDgt8=", 70 + "owner": "hercules-ci", 71 + "repo": "flake-parts", 72 + "rev": "0bdadb1b265fb4143a75bd1ec7d8c915898a9923", 73 + "type": "github" 74 + }, 75 + "original": { 76 + "owner": "hercules-ci", 77 + "repo": "flake-parts", 78 + "type": "github" 79 + } 80 + }, 81 + "import-tree": { 82 + "locked": { 83 + "lastModified": 1762327901, 84 + "narHash": "sha256-AJ96FNj50DU0bTyIzAPkPOjCZTHqjURVjok8qoXvmqM=", 85 + "owner": "vic", 86 + "repo": "import-tree", 87 + "rev": "90fa129798be99cde036b78658e89475710966a1", 88 + "type": "github" 89 + }, 90 + "original": { 91 + "owner": "vic", 92 + "repo": "import-tree", 93 + "type": "github" 94 + } 95 + }, 96 + "nixpkgs": { 97 + "locked": { 98 + "lastModified": 1762482733, 99 + "narHash": "sha256-g/da4FzvckvbiZT075Sb1/YDNDr+tGQgh4N8i5ceYMg=", 100 + "owner": "nixos", 101 + "repo": "nixpkgs", 102 + "rev": "e1ebeec86b771e9d387dd02d82ffdc77ac753abc", 103 + "type": "github" 104 + }, 105 + "original": { 106 + "owner": "nixos", 107 + "ref": "nixpkgs-unstable", 108 + "repo": "nixpkgs", 109 + "type": "github" 110 + } 111 + }, 112 + "root": { 113 + "inputs": { 114 + "checkmate-modules": "checkmate-modules", 115 + "den": "den", 116 + "flake-aspects": "flake-aspects", 117 + "flake-file": "flake-file", 118 + "flake-parts": "flake-parts", 119 + "import-tree": "import-tree", 120 + "nixpkgs": "nixpkgs", 121 + "nixpkgs-lib": [ 122 + "nixpkgs" 123 + ], 124 + "systems": "systems", 125 + "target": "target" 126 + } 127 + }, 128 + "systems": { 129 + "locked": { 130 + "lastModified": 1681028828, 131 + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 132 + "owner": "nix-systems", 133 + "repo": "default", 134 + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 135 + "type": "github" 136 + }, 137 + "original": { 138 + "owner": "nix-systems", 139 + "repo": "default", 140 + "type": "github" 141 + } 142 + }, 143 + "target": { 144 + "locked": { 145 + "path": "..", 146 + "type": "path" 147 + }, 148 + "original": { 149 + "path": "..", 150 + "type": "path" 151 + }, 152 + "parent": [] 153 + } 154 + }, 155 + "root": "root", 156 + "version": 7 157 + }
+46
templates/dendritic/checkmate/flake.nix
··· 1 + # DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file. 2 + # Use `nix run .#write-flake` to regenerate it. 3 + { 4 + 5 + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); 6 + 7 + inputs = { 8 + checkmate-modules = { 9 + flake = false; 10 + url = "path:/home/vic/hk/checkmate/modules/checkmate"; 11 + }; 12 + den = { 13 + url = "github:vic/den"; 14 + }; 15 + flake-aspects = { 16 + url = "github:vic/flake-aspects"; 17 + }; 18 + flake-file = { 19 + url = "github:vic/flake-file"; 20 + }; 21 + flake-parts = { 22 + inputs = { 23 + nixpkgs-lib = { 24 + follows = "nixpkgs-lib"; 25 + }; 26 + }; 27 + url = "github:hercules-ci/flake-parts"; 28 + }; 29 + import-tree = { 30 + url = "github:vic/import-tree"; 31 + }; 32 + nixpkgs = { 33 + url = "github:nixos/nixpkgs/nixpkgs-unstable"; 34 + }; 35 + nixpkgs-lib = { 36 + follows = "nixpkgs"; 37 + }; 38 + systems = { 39 + url = "github:nix-systems/default"; 40 + }; 41 + target = { 42 + url = "path:.."; 43 + }; 44 + }; 45 + 46 + }
+6
templates/dendritic/checkmate/modules/dendritic.nix
··· 1 + { inputs, ... }: 2 + { 3 + imports = [ 4 + inputs.flake-file.flakeModules.dendritic 5 + ]; 6 + }
+9
templates/dendritic/checkmate/modules/target.nix
··· 1 + { ... }: 2 + { 3 + flake-file.inputs = { 4 + target.url = "path:.."; 5 + checkmate-modules.url = "github:vic/checkmate?dir=modules/checkmate"; 6 + checkmate-modules.flake = false; 7 + }; 8 + # imports = [ (inputs.import-tree inputs.checkmate-modules) ]; 9 + }
+6
templates/dendritic/checkmate/modules/test.nix
··· 1 + { 2 + flake.tests."universe works" = { 3 + expr = 2 * 2; 4 + expected = 4; 5 + }; 6 + }
+5
templates/dendritic/flake.nix
··· 1 + { 2 + outputs = _: { 3 + lib.dup = a: a * 2; 4 + }; 5 + }
-8
templates/failure/checkmate.nix
··· 1 - { 2 - perSystem.nix-unit.tests = { 3 - checkmate."test fails" = { 4 - expr = 11; 5 - expected = 99; 6 - }; 7 - }; 8 - }
-3
templates/failure/flake.nix
··· 1 - { 2 - outputs = _: { flakeModules.checkmate = ./checkmate.nix; }; 3 - }
-18
templates/success/checkmate.nix
··· 1 - { inputs, ... }: 2 - let 3 - self = inputs.target; 4 - dep = self.inputs.dep; # access dependencies using target 5 - in 6 - { 7 - perSystem = ( 8 - { lib, ... }: 9 - { 10 - nix-unit.tests = { 11 - checkmate."test access inputs via target" = { 12 - expr = lib.removePrefix "x86_64-" (lib.elemAt (import dep) 0); 13 - expected = "linux"; 14 - }; 15 - }; 16 - } 17 - ); 18 - }
+7
templates/success/checkmate/modules/test.nix
··· 1 + { inputs, ... }: 2 + { 3 + flake.tests."test target lib works" = { 4 + expr = inputs.target.lib.dup 12; 5 + expected = 24; 6 + }; 7 + }
+3 -2
templates/success/flake.nix
··· 1 1 { 2 - inputs.dep.url = "github:nix-systems/x86_64-linux"; # example dependency 3 - outputs = _: { flakeModules.checkmate = ./checkmate.nix; }; 2 + outputs = _: { 3 + lib.dup = a: a * 2; 4 + }; 4 5 }
-4
tests.nix modules/checkmate/nix-unit.nix
··· 1 1 { inputs, lib, ... }: 2 2 { 3 - imports = [ 4 - inputs.nix-unit.modules.flake.default 5 - ]; 6 - 7 3 perSystem.nix-unit = { 8 4 allowNetwork = lib.mkDefault true; 9 5 inputs = lib.mkDefault inputs;
-17
treefmt.nix
··· 1 - { inputs, ... }: 2 - { 3 - imports = [ inputs.treefmt-nix.flakeModule ]; 4 - 5 - perSystem = { 6 - treefmt = { 7 - projectRoot = inputs.target; 8 - projectRootFile = "flake.nix"; 9 - programs.nixfmt.enable = true; 10 - programs.nixfmt.excludes = [ ".direnv" ]; 11 - programs.deadnix.enable = true; 12 - programs.mdformat.enable = true; 13 - programs.yamlfmt.enable = true; 14 - }; 15 - }; 16 - 17 - }