mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-18 07:24:10 +01:00
Merge pull request #96 from ryan4yin/darwin-eval-tests
feat(tests): add eval tests for darwin systems
This commit is contained in:
@@ -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;};
|
||||
};
|
||||
}
|
||||
|
||||
10
outputs/aarch64-darwin/tests/home-manager/expected.nix
Normal file
10
outputs/aarch64-darwin/tests/home-manager/expected.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"fern"
|
||||
];
|
||||
in
|
||||
lib.genAttrs hosts (_: "/Users/${username}")
|
||||
15
outputs/aarch64-darwin/tests/home-manager/expr.nix
Normal file
15
outputs/aarch64-darwin/tests/home-manager/expr.nix
Normal 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
|
||||
)
|
||||
8
outputs/aarch64-darwin/tests/hostname/expected.nix
Normal file
8
outputs/aarch64-darwin/tests/hostname/expected.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
hostsNames = builtins.attrNames outputs.darwinConfigurations;
|
||||
expected = lib.genAttrs hostsNames (name: name);
|
||||
in
|
||||
expected
|
||||
9
outputs/aarch64-darwin/tests/hostname/expr.nix
Normal file
9
outputs/aarch64-darwin/tests/hostname/expr.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}:
|
||||
lib.genAttrs
|
||||
(builtins.attrNames outputs.darwinConfigurations)
|
||||
(
|
||||
name: outputs.darwinConfigurations.${name}.config.networking.hostName
|
||||
)
|
||||
@@ -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 =
|
||||
|
||||
@@ -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;};
|
||||
};
|
||||
}
|
||||
|
||||
10
outputs/x86_64-darwin/tests/home-manager/expected.nix
Normal file
10
outputs/x86_64-darwin/tests/home-manager/expected.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"harmonica"
|
||||
];
|
||||
in
|
||||
lib.genAttrs hosts (_: "/Users/${username}")
|
||||
15
outputs/x86_64-darwin/tests/home-manager/expr.nix
Normal file
15
outputs/x86_64-darwin/tests/home-manager/expr.nix
Normal 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
|
||||
)
|
||||
8
outputs/x86_64-darwin/tests/hostname/expected.nix
Normal file
8
outputs/x86_64-darwin/tests/hostname/expected.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
hostsNames = builtins.attrNames outputs.darwinConfigurations;
|
||||
expected = lib.genAttrs hostsNames (name: name);
|
||||
in
|
||||
expected
|
||||
9
outputs/x86_64-darwin/tests/hostname/expr.nix
Normal file
9
outputs/x86_64-darwin/tests/hostname/expr.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}:
|
||||
lib.genAttrs
|
||||
(builtins.attrNames outputs.darwinConfigurations)
|
||||
(
|
||||
name: outputs.darwinConfigurations.${name}.config.networking.hostName
|
||||
)
|
||||
Reference in New Issue
Block a user