mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-25 23:36:16 +02:00
refact: concatMapAttrs -> flatMapAttrs
This should be slightly easier to read. We could apply this to all concatMapAttrs calls.
This commit is contained in:
parent
ac89828b5a
commit
6a28566db6
1 changed files with 23 additions and 8 deletions
31
flake.nix
31
flake.nix
|
@ -58,6 +58,18 @@
|
|||
"stdenv"
|
||||
];
|
||||
|
||||
/**
|
||||
`flatMapAttrs attrs f` applies `f` to each attribute in `attrs` and
|
||||
merges the results into a single attribute set.
|
||||
|
||||
This can be nested to form a build matrix where all the attributes
|
||||
generated by the innermost `f` are returned as is.
|
||||
(Provided that the names are unique.)
|
||||
|
||||
See https://nixos.org/manual/nixpkgs/stable/index.html#function-library-lib.attrsets.concatMapAttrs
|
||||
*/
|
||||
flatMapAttrs = attrs: f: lib.concatMapAttrs f attrs;
|
||||
|
||||
forAllSystems = lib.genAttrs systems;
|
||||
|
||||
forAllCrossSystems = lib.genAttrs crossSystems;
|
||||
|
@ -319,17 +331,20 @@
|
|||
# system, we should reenable this.
|
||||
#perlBindings = self.hydraJobs.perlBindings.${system};
|
||||
}
|
||||
// lib.concatMapAttrs (nixpkgsPrefix: nixpkgs:
|
||||
lib.concatMapAttrs (pkgName: pkg:
|
||||
lib.concatMapAttrs (testName: test: {
|
||||
# Add "passthru" tests
|
||||
"${nixpkgsPrefix}${pkgName}-${testName}" = test;
|
||||
}) pkg.tests or {}
|
||||
) nixpkgs.nix-components
|
||||
) {
|
||||
# Add "passthru" tests
|
||||
// flatMapAttrs {
|
||||
"" = nixpkgsFor.${system}.native;
|
||||
"static-" = nixpkgsFor.${system}.static;
|
||||
}
|
||||
(nixpkgsPrefix: nixpkgs:
|
||||
flatMapAttrs nixpkgs.nix-components
|
||||
(pkgName: pkg:
|
||||
flatMapAttrs pkg.tests or {}
|
||||
(testName: test: {
|
||||
"${nixpkgsPrefix}${pkgName}-${testName}" = test;
|
||||
})
|
||||
)
|
||||
)
|
||||
// devFlake.checks.${system} or {}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue