Merge pull request #96 from ryan4yin/darwin-eval-tests

feat(tests): add eval tests for darwin systems
This commit is contained in:
Ryan Yin
2024-03-14 01:14:42 +08:00
committed by GitHub
11 changed files with 104 additions and 1 deletions

View File

@@ -19,3 +19,12 @@
};
in
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
};
}

View File

@@ -0,0 +1,10 @@
{
myvars,
lib,
}: let
username = myvars.username;
hosts = [
"fern"
];
in
lib.genAttrs hosts (_: "/Users/${username}")

View File

@@ -0,0 +1,15 @@
{
myvars,
lib,
outputs,
}: let
username = myvars.username;
hosts = [
"fern"
];
in
lib.genAttrs
hosts
(
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)

View File

@@ -0,0 +1,8 @@
{
lib,
outputs,
}: let
hostsNames = builtins.attrNames outputs.darwinConfigurations;
expected = lib.genAttrs hostsNames (name: name);
in
expected

View File

@@ -0,0 +1,9 @@
{
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.darwinConfigurations)
(
name: outputs.darwinConfigurations.${name}.config.networking.hostName
)

View File

@@ -45,6 +45,7 @@
allSystemNames = builtins.attrNames allSystems;
nixosSystemValues = builtins.attrValues nixosSystems;
darwinSystemValues = builtins.attrValues darwinSystems;
allSystemValues = nixosSystemValues ++ darwinSystemValues;
# Helper function to generate a set of attributes for each system
forAllSystems = func: (nixpkgs.lib.genAttrs allSystemNames func);
@@ -53,7 +54,7 @@ in {
debugAttrs = {inherit nixosSystems darwinSystems allSystems allSystemNames;};
# Unit Tests for all NixOS systems.
evalTests = lib.lists.all (it: it.evalTests == {}) nixosSystemValues;
evalTests = lib.lists.all (it: it.evalTests == {}) allSystemValues;
# NixOS Hosts
nixosConfigurations =

View File

@@ -19,3 +19,12 @@
};
in
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
};
}

View File

@@ -0,0 +1,10 @@
{
myvars,
lib,
}: let
username = myvars.username;
hosts = [
"harmonica"
];
in
lib.genAttrs hosts (_: "/Users/${username}")

View File

@@ -0,0 +1,15 @@
{
myvars,
lib,
outputs,
}: let
username = myvars.username;
hosts = [
"harmonica"
];
in
lib.genAttrs
hosts
(
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)

View File

@@ -0,0 +1,8 @@
{
lib,
outputs,
}: let
hostsNames = builtins.attrNames outputs.darwinConfigurations;
expected = lib.genAttrs hostsNames (name: name);
in
expected

View File

@@ -0,0 +1,9 @@
{
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.darwinConfigurations)
(
name: outputs.darwinConfigurations.${name}.config.networking.hostName
)