Skip to content

Commit 307961a

Browse files
committed
refactor: expose haskellProjectTests in flake module
Because we want to use it in multiple tests.
1 parent d128c73 commit 307961a

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
description = "A `flake-parts` module for Haskell development";
3-
outputs = { ... }: {
3+
outputs = _: {
44
flakeModule = ./nix/modules;
55

66
templates.default = {

nix/modules/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
imports = [
3-
./project-modules.nix
43
./projects.nix
4+
./project-modules.nix
5+
./project-tests.nix
56
];
67
}

test/with-subdir/haskell-flake-patch.nix renamed to nix/modules/project-tests.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# A convenient module for testing haskell-flake behaviour.
12
{ self, lib, flake-parts-lib, ... }:
23

34
let
@@ -11,6 +12,10 @@ in
1112
options.perSystem = mkPerSystemOption ({ config, self', pkgs, ... }: {
1213
options = {
1314
haskellProjectTests = mkOption {
15+
description = ''
16+
Patch an existing `haskellProject` to run some checks. This module
17+
will create a flake check automatically.
18+
'';
1419
type = types.attrsOf (types.submoduleWith {
1520
specialArgs = { inherit pkgs self; };
1621
modules = [
@@ -19,6 +24,9 @@ in
1924
from = lib.mkOption {
2025
type = types.str;
2126
default = "default";
27+
description = ''
28+
Which `haskellProjects.??` to patch.
29+
'';
2230
};
2331
patches = lib.mkOption {
2432
type = types.listOf (types.either types.path types.str);
@@ -30,7 +38,10 @@ in
3038
};
3139
expect = lib.mkOption {
3240
type = types.raw;
33-
description = "Test expectation";
41+
description = ''
42+
Arbitrary expression to evaluate as part of the generated
43+
flake check
44+
'';
3445
};
3546
};
3647
}

test/with-subdir/flake.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
systems = nixpkgs.lib.systems.flakeExposed;
1313
imports = [
1414
inputs.haskell-flake.flakeModule
15-
./haskell-flake-patch.nix
1615
];
1716
debug = true;
1817
perSystem = { config, self', pkgs, lib, ... }: {

0 commit comments

Comments
 (0)