File tree Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Expand file tree Collapse file tree 1 file changed +52
-0
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ self ,
3
+ inputs ,
4
+ ...
5
+ } : {
2
6
flake . templates = {
3
7
default = {
4
8
path = ../templates/simple ;
5
9
description = "A simple nix flake template for getting started with nixvim" ;
6
10
} ;
7
11
} ;
12
+
13
+ # The following adds the template flake's checks to the main (current) flake's checks.
14
+ # It ensures that the template's own checks are successful.
15
+ perSystem = {
16
+ pkgs ,
17
+ system ,
18
+ lib ,
19
+ ...
20
+ } : {
21
+ checks = let
22
+ # Approximates https://github.com/NixOS/nix/blob/7cd08ae379746749506f2e33c3baeb49b58299b8/src/libexpr/flake/call-flake.nix#L46
23
+ # s/flake.outputs/args.outputs/
24
+ callFlake = args @ {
25
+ inputs ,
26
+ outputs ,
27
+ sourceInfo ,
28
+ } : let
29
+ outputs = args . outputs ( inputs // { self = result ; } ) ;
30
+ result =
31
+ outputs
32
+ // sourceInfo
33
+ // {
34
+ inherit inputs outputs sourceInfo ;
35
+ _type = "flake" ;
36
+ } ;
37
+ in
38
+ result ;
39
+
40
+ templateFlakeOuputs = callFlake {
41
+ inputs = {
42
+ inherit ( inputs ) flake-parts nixpkgs ;
43
+ nixvim = self ;
44
+ } ;
45
+ # Import and read the `outputs` field of the template flake.
46
+ inherit ( import ../templates/simple/flake.nix ) outputs ;
47
+ sourceInfo = { } ;
48
+ } ;
49
+
50
+ templateChecks = templateFlakeOuputs . checks . ${ system } ;
51
+ in
52
+ lib . concatMapAttrs
53
+ (
54
+ checkName : check : {
55
+ "template-${ checkName } " = check ;
56
+ }
57
+ )
58
+ templateChecks ;
59
+ } ;
8
60
}
You can’t perform that action at this time.
0 commit comments