Skip to content

Commit a206dac

Browse files
parzivaleclaude
andcommitted
flake: hide flattenTests prefix accumulator behind inner go function
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent df75378 commit a206dac

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

flake.nix

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,26 @@
2929
pkgsFor = system: import sources.nixpkgs { inherit system; };
3030

3131
flattenTests =
32-
lib: prefix: tests:
33-
builtins.foldl' lib.recursiveUpdate { } (
34-
lib.mapAttrsToList (
35-
name: value:
36-
let
37-
key = if prefix == "" then name else "${prefix}-${name}";
38-
in
39-
if lib.isDerivation value then
40-
{ ${key} = value; }
41-
else if builtins.isAttrs value then
42-
flattenTests lib key value
43-
else
44-
{ }
45-
) tests
46-
);
32+
lib: tests:
33+
let
34+
go =
35+
prefix: attrs:
36+
builtins.foldl' lib.recursiveUpdate { } (
37+
lib.mapAttrsToList (
38+
name: value:
39+
let
40+
key = if prefix == "" then name else "${prefix}-${name}";
41+
in
42+
if lib.isDerivation value then
43+
{ ${key} = value; }
44+
else if builtins.isAttrs value then
45+
go key value
46+
else
47+
{ }
48+
) attrs
49+
);
50+
in
51+
go "" tests;
4752
in
4853
{
4954
formatter = forSystems systems (system: (pkgsFor system).nixfmt-tree);
@@ -53,7 +58,7 @@
5358
let
5459
pkgs = pkgsFor system;
5560
in
56-
flattenTests pkgs.lib "" (import ./tests { inherit pkgs; })
61+
flattenTests pkgs.lib (import ./tests { inherit pkgs; })
5762
);
5863

5964
finixModules = import ./modules;

0 commit comments

Comments
 (0)