diff --git a/checks/default.nix b/checks/default.nix index 81883ba..66d5b0b 100644 --- a/checks/default.nix +++ b/checks/default.nix @@ -4,7 +4,7 @@ pkgs, deployPkgs, ... -}@inputs: +}: { ${system} = { diff --git a/checks/nixos-modules/default.nix b/checks/nixos-modules/default.nix index ea8eace..74e8a25 100644 --- a/checks/nixos-modules/default.nix +++ b/checks/nixos-modules/default.nix @@ -54,7 +54,7 @@ let in pipe modulesBaseDir [ getSubDirs - (filter (isFolderWithFile "test.nix")) + (filter (isFolderWithFile "test.nix" modulesBaseDir)) (map mkTest) (linkFarmFromDrvs "nixos-modules") ] diff --git a/lib/default.nix b/lib/default.nix index 8df2940..e4cd3ee 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -7,16 +7,20 @@ let pathExists path ; + # Get a list of all subdirectories of a directory. + getSubDirs = base: attrNames (filterAttrs (n: t: t == "directory") (builtins.readDir base)); + # Check if a folder with a base path and folder name contains a file with a specific name isFolderWithFile = fileName: basePath: folderName: - (pathExists (path.append basePath "./${folderName}/${fileName}.nix")); - getSubDirs = base: attrNames (filterAttrs (n: t: t == "directory") (builtins.readDir base)); - foldersWithNix = base: filter (isFolderWithFile "default.nix") (getSubDirs base); + (pathExists (path.append basePath "./${folderName}/${fileName}")); + # Get a list of subfolders that contain a default.nix file. + foldersWithNix = base: filter (isFolderWithFile "default.nix" base) (getSubDirs base); in { - inherit isFolderWithFile foldersWithNix; + inherit getSubDirs isFolderWithFile foldersWithNix; + # Get a list of default.nix files that are nix submodules of the current folder. loadSubmodulesFrom = basePath: map (folder: path.append basePath "./${folder}/default.nix") (foldersWithNix basePath); } diff --git a/nixos-modules/static-page/test.py b/nixos-modules/static-page/test.py index 0dc69fc..5c273d5 100644 --- a/nixos-modules/static-page/test.py +++ b/nixos-modules/static-page/test.py @@ -37,7 +37,7 @@ def test(subtest, webserver): expect_http_content(webserver, indexContent, "http://localhost/index.html") - with subtest("example.com is a hosts alias and redirects to localhost"): + with subtest("example.com is a hosts alias and redirect"): webserver.succeed("grep example.com /etc/hosts") url = "http://example.com/index.html"