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