Skip to content

Commit 48f2cfa

Browse files
authored
Merge pull request #96 from ryan4yin/darwin-eval-tests
feat(tests): add eval tests for darwin systems
2 parents 532121e + a4d3867 commit 48f2cfa

File tree

11 files changed

+104
-1
lines changed

11 files changed

+104
-1
lines changed

outputs/aarch64-darwin/default.nix

+9
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@
1919
};
2020
in
2121
outputs
22+
// {
23+
inherit data; # for debugging purposes
24+
25+
# NixOS's unit tests.
26+
evalTests = haumea.lib.loadEvalTests {
27+
src = ./tests;
28+
inputs = args // {inherit outputs;};
29+
};
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
myvars,
3+
lib,
4+
}: let
5+
username = myvars.username;
6+
hosts = [
7+
"fern"
8+
];
9+
in
10+
lib.genAttrs hosts (_: "/Users/${username}")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
myvars,
3+
lib,
4+
outputs,
5+
}: let
6+
username = myvars.username;
7+
hosts = [
8+
"fern"
9+
];
10+
in
11+
lib.genAttrs
12+
hosts
13+
(
14+
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
15+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
lib,
3+
outputs,
4+
}: let
5+
hostsNames = builtins.attrNames outputs.darwinConfigurations;
6+
expected = lib.genAttrs hostsNames (name: name);
7+
in
8+
expected
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
lib,
3+
outputs,
4+
}:
5+
lib.genAttrs
6+
(builtins.attrNames outputs.darwinConfigurations)
7+
(
8+
name: outputs.darwinConfigurations.${name}.config.networking.hostName
9+
)

outputs/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
allSystemNames = builtins.attrNames allSystems;
4646
nixosSystemValues = builtins.attrValues nixosSystems;
4747
darwinSystemValues = builtins.attrValues darwinSystems;
48+
allSystemValues = nixosSystemValues ++ darwinSystemValues;
4849

4950
# Helper function to generate a set of attributes for each system
5051
forAllSystems = func: (nixpkgs.lib.genAttrs allSystemNames func);
@@ -53,7 +54,7 @@ in {
5354
debugAttrs = {inherit nixosSystems darwinSystems allSystems allSystemNames;};
5455

5556
# Unit Tests for all NixOS systems.
56-
evalTests = lib.lists.all (it: it.evalTests == {}) nixosSystemValues;
57+
evalTests = lib.lists.all (it: it.evalTests == {}) allSystemValues;
5758

5859
# NixOS Hosts
5960
nixosConfigurations =

outputs/x86_64-darwin/default.nix

+9
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,12 @@
1919
};
2020
in
2121
outputs
22+
// {
23+
inherit data; # for debugging purposes
24+
25+
# NixOS's unit tests.
26+
evalTests = haumea.lib.loadEvalTests {
27+
src = ./tests;
28+
inputs = args // {inherit outputs;};
29+
};
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
myvars,
3+
lib,
4+
}: let
5+
username = myvars.username;
6+
hosts = [
7+
"harmonica"
8+
];
9+
in
10+
lib.genAttrs hosts (_: "/Users/${username}")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
myvars,
3+
lib,
4+
outputs,
5+
}: let
6+
username = myvars.username;
7+
hosts = [
8+
"harmonica"
9+
];
10+
in
11+
lib.genAttrs
12+
hosts
13+
(
14+
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
15+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
lib,
3+
outputs,
4+
}: let
5+
hostsNames = builtins.attrNames outputs.darwinConfigurations;
6+
expected = lib.genAttrs hostsNames (name: name);
7+
in
8+
expected
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
lib,
3+
outputs,
4+
}:
5+
lib.genAttrs
6+
(builtins.attrNames outputs.darwinConfigurations)
7+
(
8+
name: outputs.darwinConfigurations.${name}.config.networking.hostName
9+
)

0 commit comments

Comments
 (0)