flake: use listFilesRecursive for tests

This commit is contained in:
Donovan Glover 2024-10-09 19:25:40 -04:00
parent c8adf93d0b
commit bb65333491
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -34,7 +34,8 @@
...
}@attrs:
let
inherit (nixpkgs.lib) nixosSystem packagesFromDirectoryRecursive;
inherit (nixpkgs.lib) nixosSystem;
inherit (nixpkgs.lib.filesystem) packagesFromDirectoryRecursive listFilesRecursive;
inherit (nixpkgs.legacyPackages) x86_64-linux aarch64-linux;
inherit (builtins)
@ -49,14 +50,12 @@
"overlays"
"nixosModules"
"homeModules"
"checks"
];
flakeDirectories = [
"overlays"
"modules"
"home"
"tests"
];
forAllSystems = function:
@ -71,6 +70,15 @@
directory = ./packages;
});
checks.x86_64-linux = listToAttrs (map (file: {
name = replaceStrings [ ".nix" ] [ "" ] (baseNameOf (toString file));
value = import file {
inherit self;
pkgs = x86_64-linux;
};
}) (listFilesRecursive ./tests));
nixosConfigurations =
let
phoneModules = [
@ -139,22 +147,11 @@
attributeValue = listToAttrs (
map (file: {
name = replaceStrings [ ".nix" ] [ "" ] file;
value =
if directory == "tests" then
import ./${directory}/${file} {
inherit self;
pkgs = x86_64-linux;
}
else
import ./${directory}/${file};
value = import ./${directory}/${file};
}) (attrNames (readDir ./${directory}))
);
attributeSet =
if directory == "tests" then
{ x86_64-linux = attributeValue; }
else
attributeValue;
attributeSet = attributeValue;
in
attributeSet;
}) flakeOutputs