-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
139 lines (138 loc) · 4.39 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
treefmt-nix.url = "github:numtide/treefmt-nix";
# Pull templates from external flake-parts modules
# The pull happens in CI periodically.
haskell-flake.url = "github:srid/haskell-flake";
haskell-flake.flake = false;
haskell-template.url = "github:srid/haskell-template";
haskell-template.flake = false;
nix-dev-home.url = "github:juspay/nix-dev-home";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem = {
treefmt.config = {
projectRootFile = "flake.nix";
programs = {
nixpkgs-fmt.enable = true;
};
};
};
flake = {
# TODO: Ideally, these params should be moved to upstream module.
# But do that only as the spec stabilizes.
templates = rec {
nix-dev-home = inputs.nix-dev-home.templates.default // {
tags = [ "home-manager" "juspay" "development" ];
params = [
{
name = "Username";
help = "Your username as shown by by $USER";
default = "runner";
required = true;
files = [
"flake.nix"
];
}
{
name = "Full Name";
help = "Your full name for use in Git config";
default = "John Doe";
required = true;
files = [
"home/default.nix"
];
}
{
name = "Email";
help = "Your email for use in Git config";
default = "johndoe@example.com";
required = true;
files = [
"home/default.nix"
];
}
{
name = "GitHub Actions CI";
help = "Include GitHub Actions workflow configuration";
default = false;
files = [
".github"
];
}
];
};
haskell-flake = {
description = "Haskell project template, using haskell-flake";
path = builtins.path { path = inputs.haskell-flake + /example; };
tags = [ "haskell" "haskell-flake" ];
params = [
{
name = "Package Name";
help = "Name of the Haskell package";
default = "example";
required = false;
files = [
"example.cabal"
"flake.nix"
];
}
];
};
haskell-template = {
description = "A batteries-included Haskell project template";
path = builtins.path { path = inputs.haskell-template; };
tags = [ "haskell" "haskell-flake" "relude" "just" ];
params = [
{
name = "Package Name";
help = "Name of the Haskell package";
default = "haskell-template";
required = false;
files = [
"haskell-template.cabal"
"flake.nix"
"justfile"
];
}
{
name = "Author";
help = "Author name";
default = "Sridhar Ratnakumar";
required = false;
files = [
"haskell-template.cabal"
"LICENSE"
];
}
{
name = "VSCode support";
help = "Include the VSCode settings folder (./.vscode)";
default = true;
files = [
".vscode"
];
}
{
name = "GitHub Actions CI";
help = "Include GitHub Actions workflow configuration";
default = true;
files = [
".github"
];
}
];
};
};
herculesCI.ciSystems = [ "x86_64-linux" ];
};
};
}