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

dont expose functor

+19 -29
-21
default.nix
··· 1 - inputs: 2 - let 3 - functor = 4 - _: target: newModule: 5 - inputs.flake-parts.lib.mkFlake 6 - { 7 - inputs = inputs // { 8 - inherit target; 9 - }; 10 - } 11 - { 12 - imports = [ 13 - newModule 14 - ./flakeModule.nix 15 - ]; 16 - }; 17 - 18 - flake = inputs.flake-parts.lib.mkFlake { inherit inputs; } ./flakeModule.nix; 19 - 20 - in 21 - flake // { __functor = functor; }
+1 -1
flake.nix
··· 16 16 treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; 17 17 }; 18 18 19 - outputs = inputs: import ./. inputs; 19 + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } ./flakeModule.nix; 20 20 }
+18 -4
flakeModule.nix
··· 1 1 { inputs, ... }: 2 + let 3 + flakeModule = { 4 + systems = import inputs.systems; 5 + imports = [ 6 + ./perSystem-lib.nix 7 + ./tests.nix 8 + ./treefmt.nix 9 + ]; 10 + }; 11 + 12 + # Tests are defined by target, and imported bellow by `inputs.target.flakeModules.nix-unit`. 13 + # See example/flake.nix or https://github.com/vic/import-tree/tree/main/checks/default.nix 14 + targetTest = inputs.target.flakeModules.nix-unit or { }; 15 + in 2 16 { 3 - systems = import inputs.systems; 4 17 imports = [ 5 - ./perSystem-lib.nix 6 - ./tests.nix 7 - ./treefmt.nix 18 + flakeModule 19 + targetTest 8 20 ]; 21 + 22 + flake.flakeModules.default = flakeModule; 9 23 }
-3
tests.nix
··· 1 1 { inputs, ... }: 2 2 { 3 3 imports = [ 4 - # Tests are defined by target, and imported bellow by `inputs.target.flakeModules.nix-unit`. 5 - # See example/flake.nix or https://github.com/vic/import-tree/tree/main/checks/default.nix 6 - inputs.target.flakeModules.nix-unit 7 4 inputs.nix-unit.modules.flake.default 8 5 ]; 9 6