Skip to content

Commit 2fde5d0

Browse files
authored
Add autoWire option, to control flake outputs (#134)
* Add autoWire option, to control flake outputs * add changelog
1 parent 65c1667 commit 2fde5d0

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Revision history for haskell-flake
22

3+
## `master`
4+
5+
- #134: Add `autoWire` option to control generation of flake outputs
6+
37
## 0.2.0 (Mar 13, 2023)
48

59
- New features

nix/flake-module.nix

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,17 @@ in
256256
This is an internal option, not meant to be set by the user.
257257
'';
258258
};
259+
autoWire = mkOption {
260+
type = types.bool;
261+
description = ''
262+
Automatically wire up the project outputs to the flake outputs.
259263
260-
264+
Disable this if you want to control the flake outputs
265+
yourself. Useful, for example, when overriding the default
266+
shell.
267+
'';
268+
default = true;
269+
};
261270
};
262271
})
263272
];
@@ -269,7 +278,6 @@ in
269278
description = "Haskell projects";
270279
type = types.attrsOf projectSubmodule;
271280
};
272-
273281
};
274282

275283
config =
@@ -290,19 +298,19 @@ in
290298
then packageName
291299
else "${name}-${packageName}";
292300
in
293-
mapKeys dropDefaultPrefix project.outputs.localPackages)
301+
lib.optionalAttrs project.autoWire (mapKeys dropDefaultPrefix project.outputs.localPackages))
294302
config.haskellProjects;
295303
devShells =
296304
mergeMapAttrs
297305
(name: project:
298-
lib.optionalAttrs project.devShell.enable {
306+
lib.optionalAttrs (project.autoWire && project.devShell.enable) {
299307
"${name}" = project.outputs.devShell;
300308
})
301309
config.haskellProjects;
302310
checks =
303311
mergeMapAttrs
304312
(name: project:
305-
lib.optionalAttrs (project.devShell.enable && project.devShell.hlsCheck.enable) {
313+
lib.optionalAttrs (project.autoWire && project.devShell.enable && project.devShell.hlsCheck.enable) {
306314
"${name}-hls" = project.outputs.hlsCheck;
307315
})
308316
config.haskellProjects;

0 commit comments

Comments
 (0)