forked from hercules-ci/flake.parts-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
379 lines (322 loc) · 15.4 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
{
description = "The https://flake.parts website";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:hercules-ci/devenv/flake-module";
devshell.url = "github:numtide/devshell";
devshell.inputs.nixpkgs.follows = "nixpkgs"; # https://github.com/NixOS/nix/issues/7730
dream2nix_legacy.inputs.pre-commit-hooks.follows = "pre-commit-hooks-nix";
dream2nix_legacy.inputs.nixpkgs.follows = "nixpkgs";
dream2nix_legacy.url = "github:nix-community/dream2nix/c9c8689f09aa95212e75f3108788862583a1cf5a";
emanote.url = "github:srid/emanote";
emanote.inputs.nixpkgs.follows = "nixpkgs";
haskell-flake.url = "github:srid/haskell-flake";
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
mission-control.url = "github:Platonic-Systems/mission-control";
nix-cargo-integration.url = "github:yusdacra/nix-cargo-integration";
nix-cargo-integration.inputs.nixpkgs.follows = "nixpkgs";
nix-cargo-integration.inputs.dream2nix.follows = "dream2nix_legacy";
pre-commit-hooks-nix.url = "github:cachix/pre-commit-hooks.nix";
pre-commit-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
proc-flake.url = "github:srid/proc-flake";
process-compose-flake.url = "github:hercules-ci/process-compose-flake/fix-docs";
std.url = "github:divnix/std";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: {
perSystem.render.inputs = {
devenv = {
title = "devenv";
baseUrl = "https://github.com/cachix/devenv/blob/main";
attributePath = [ "flakeModule" ];
intro = ''
[`devenv`](https://devenv.sh) provides a devShell with many options, and container packages.
See also the [setup guide at devenv.sh](https://devenv.sh/guides/using-with-flake-parts/).
'';
killLinks = true;
};
devshell = {
title = "devshell";
baseUrl = "https://github.com/numtide/devshell/blob/main";
intro = ''
Simple per-project developer environments.
Example:
```nix
perSystem = { config, pkgs, ... }: {
devshells.default = {
env = [
{
name = "HTTP_PORT";
value = 8080;
}
];
commands = [
{
help = "print hello";
name = "hello";
command = "echo hello";
}
];
packages = [
pkgs.cowsay
];
};
};
```
See also the [`devshell` project page](https://github.com/numtide/devshell)
'';
};
dream2nix = {
title = "dream2nix";
baseUrl = "https://github.com/nix-community/dream2nix/blob/main";
flakeRef = "github:nix-community/dream2nix";
intro = ''
This page is a placeholder while dream2nix v1 is in the works.
See [dream2nix_legacy](./dream2nix_legacy.html) for the previous API.
'';
installation = "";
attributePath = [ "modules" "flake-parts" "all-modules" ];
flake = { modules.flake-parts.all-modules = { }; outPath = "/x"; };
};
dream2nix_legacy = {
title = "dream2nix legacy";
baseUrl = "https://github.com/nix-community/dream2nix/blob/c9c8689f09aa95212e75f3108788862583a1cf5a";
flakeRef = "github:nix-community/dream2nix/c9c8689f09aa95212e75f3108788862583a1cf5a";
attributePath = [ "flakeModuleBeta" ];
intro = ''
[`dream2nix`](https://github.com/nix-community/dream2nix#readme) scans your flake files and turns them into packages.
NOTE: a new version of dream2nix, v1, is in the works, and we're figuring out how best to use it.
'';
};
emanote = {
baseUrl = "https://github.com/srid/emanote/blob/master";
intro = ''
[`Emanote`](https://github.com/srid/emanote) renders your Markdown
files as a nice static site with hot reload.
Use `nix run` to run the live server, and `nix build` to build the
static site.
See
[emanote-template](https://github.com/srid/emanote-template/blob/master/flake.nix)
for an example `flake.nix`.
'';
};
flake-parts = {
title = "Core Options";
baseUrl = "https://github.com/hercules-ci/flake-parts/blob/main";
getModules = _: [ ];
intro = ''
These options are provided by default. They reflect what Nix expects,
plus a small number of helpful options, notably [`perSystem`](#opt-perSystem).
'';
installation = "";
};
flake-parts-easyOverlay =
let sourceSubpath = "/extras/easyOverlay.nix";
in
{
_module.args.name = lib.mkForce "flake-parts";
flake = inputs.flake-parts;
title = "flake-parts.easyOverlay";
baseUrl = "https://github.com/hercules-ci/flake-parts/blob/main${sourceSubpath}";
getModules = f: [ f.flakeModules.easyOverlay ];
intro = ''
## WARNING
This module does NOT make _consuming_ an overlay easy. This module is intended for _creating_ overlays.
While it is possible to consume the overlay created by this module using the `final` module argument, this is somewhat unconventional. Instead:
- _Avoid_ overlays. Many flakes can do without them.
- Initialize `pkgs` yourself:
```
perSystem = { system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.foo.overlays.default
(final: prev: {
# ... things you really need to patch ...
})
];
config = { };
};
};
```
## Who this is for
This module is for flake authors who need to provide a simple overlay in addition to the common flake attributes. It is not for users who want to consume an overlay.
## What it actually does
This module overrides the `pkgs` module argument and provides the `final` module argument so that the `perSystem` module can be evaluated as an overlay. Attributes added by the overlay must be defined in `overlayAttrs`. The resulting overlay is defined in the `overlays.default` output.
The resulting behavior tends to be not 100% idiomatic. A hand-written overlay would usually use `final` more often, but nonetheless it gets the job done for simple use cases; certainly the simple use cases where overlays aren't strictly necessary.
## The status of this module
It has an unfortunate name and may be renamed. Alternatively, its functionality may be moved out of flake-parts, into some Nixpkgs module. Certainly until then, feel free to use the module if you understand what it does.
'';
installationDeclareInput = false;
attributePath = [ "flakeModules" "easyOverlay" ];
separateEval = true;
filterTransformOptions =
{ sourceName, sourcePath, baseUrl, coreOptDecls }:
let sourcePathStr = toString sourcePath + sourceSubpath;
in
opt:
let
declarations = lib.concatMap
(decl:
if lib.hasPrefix sourcePathStr (toString decl)
then
let subpath = lib.removePrefix sourcePathStr (toString decl);
in [{ url = baseUrl + subpath; name = sourceName + subpath; }]
else [ ]
)
opt.declarations;
in
if declarations == [ ]
then opt // { visible = false; }
else opt // { inherit declarations; };
};
flake-parts-flakeModules =
let sourceSubpath = "/extras/flakeModules.nix";
in
{
_module.args.name = lib.mkForce "flake-parts";
flake = inputs.flake-parts;
title = "flake-parts.flakeModules";
baseUrl = "https://github.com/hercules-ci/flake-parts/blob/main${sourceSubpath}";
getModules = f: [ f.flakeModules.flakeModules ];
intro = ''
Adds the `flakeModules` attribute and `flakeModule` alias.
This module makes deduplication and `disabledModules` work, even if the definitions are inline modules or [`importApply`](../define-module-in-separate-file.html#importapply).
'';
installationDeclareInput = false;
attributePath = [ "flakeModules" "easyOverlay" ];
separateEval = true;
filterTransformOptions =
{ sourceName, sourcePath, baseUrl, coreOptDecls }:
let sourcePathStr = toString sourcePath + sourceSubpath;
in
opt:
let
declarations = lib.concatMap
(decl:
if lib.hasPrefix sourcePathStr (toString decl)
then
let subpath = lib.removePrefix sourcePathStr (toString decl);
in [{ url = baseUrl + subpath; name = sourceName + subpath; }]
else [ ]
)
opt.declarations;
in
if declarations == [ ]
then opt // { visible = false; }
else opt // { inherit declarations; };
};
haskell-flake = {
baseUrl = "https://github.com/srid/haskell-flake/blob/master";
intro = ''
[`haskell-flake`](https://haskell.flake.page/) scans your flake files for Haskell projects and
turns them into packages using the Nixpkgs Haskell infrastructure.
It also provides [`checks`](flake-parts.html#opt-perSystem.checks) and [`devShells`](flake-parts.html#opt-perSystem.devShells)
Multiple projects can be declared to represent each package set, which is great for GHCJS frontends.
'';
};
hercules-ci-effects = {
baseUrl = "https://github.com/hercules-ci/hercules-ci-effects/blob/master";
intro = ''
This module provides
- a mergeable `herculesCI` attribute; read by [Hercules CI](https://hercules-ci.com) and the [`hci`](https://docs.hercules-ci.com/hercules-ci-agent/hci/) command,
- the [`hci-effects`](https://docs.hercules-ci.com/hercules-ci-effects/guide/import-or-pin/#_flakes_with_flake_parts) library as a module argument in `perSystem` / `withSystem`,
- ready to go, configurable continuous deployment jobs
'';
};
mission-control = {
baseUrl = "https://github.com/Platonic-Systems/mission-control/blob/main";
intro = ''
A flake-parts module for your Nix devshell scripts.
Lets you configure commands that will be run in the repository root.
Provides an informative "message of the day" when launching your shell.
See the [Platonic-Systems/mission-control readme](https://github.com/Platonic-Systems/mission-control#readme).
'';
};
nix-cargo-integration = {
title = "nix-cargo-integration";
baseUrl = "https://github.com/yusdacra/nix-cargo-integration/blob/master";
attributePath = [ "flakeModule" ];
intro = ''
Easily integrate your Rust projects into Nix.
'';
installation = ''
## Installation
See the [readme](https://github.com/yusdacra/nix-cargo-integration#readme).
'';
};
pre-commit-hooks-nix = {
baseUrl = "https://github.com/cachix/pre-commit-hooks.nix/blob/master";
intro = ''
Configure pre-commit hooks.
Generates a configuration for [pre-commit](https://pre-commit.com),
provides a script to activate it, and adds a [check](flake-parts.html#opt-perSystem.checks).
Pre-defined hooks are maintained at [`cachix/pre-commit-hooks.nix`](https://github.com/cachix/pre-commit-hooks.nix).
'';
};
proc-flake = {
baseUrl = "https://github.com/srid/proc-flake/blob/master";
intro = ''
A module for running multiple processes in a dev shell.
[honcho](https://github.com/nickstenning/honcho) is used to launch the processes.
See [proc-flake README](https://github.com/srid/proc-flake#readme)
'';
};
process-compose-flake = {
baseUrl = "https://github.com/Platonic-Systems/process-compose-flake/blob/main";
intro = ''
Declare one or more process-compose configurations using options.
Generates a wrapper for [process-compose](https://github.com/F1bonacc1/process-compose).
See [process-compose-flake](https://github.com/Platonic-Systems/process-compose-flake) for a [usage example](https://github.com/Platonic-Systems/process-compose-flake#usage).
'';
};
std = {
baseUrl = "https://github.com/divnix/std/blob/main";
intro = ''
Add definitions from the [Standard](https://github.com/divnix/std#readme) DevOps framework to your flake.
It organizes and disciplines your Nix and thereby speeds you up.
It also comes with great horizontal integrations of high quality
vertical DevOps tooling crafted by the Nix Ecosystem.
'';
};
treefmt-nix = {
baseUrl = "https://github.com/numtide/treefmt-nix/blob/master";
intro = ''
When working on large code trees, it's common to have multiple code formatters run against it. And have one script that loops over all of them. `treefmt` makes that nicer.
- A unified CLI and output
- Run all the formatters in parallel.
- Cache which files have changed for super fast re-formatting.
- Just type treefmt in any folder and it reformats the whole code tree.
This module is defined in [`numtide/treefmt-nix`](https://github.com/numtide/treefmt-nix). The `treefmt` repo is about the [tool](https://github.com/numtide/treefmt) itself.
'';
};
};
imports = [
./render/render-module.nix
./site/site-module.nix
./dev-module.nix
./deploy-module.nix
inputs.hercules-ci-effects.flakeModule
inputs.pre-commit-hooks-nix.flakeModule
];
systems = [
# Supported, see `ciSystems`
"x86_64-linux"
# Available, but may be broken by Nixpkgs updates sometimes
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
hercules-ci.flake-update = {
enable = true;
when = {
hour = [ 8 20 ];
};
autoMergeMethod = "merge";
};
herculesCI = {
ciSystems = [ "x86_64-linux" ];
};
});
}