mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-26 09:58:25 +02:00
feat: unit tests
This commit is contained in:
15
outputs/x86_64-linux/tests/home-manager/expected.nix
Normal file
15
outputs/x86_64-linux/tests/home-manager/expected.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"ai-hyprland"
|
||||
"ai-i3"
|
||||
"shoukei-hyprland"
|
||||
"shoukei-i3"
|
||||
"ruby"
|
||||
"k3s-prod-1-master-1"
|
||||
];
|
||||
in
|
||||
lib.genAttrs hosts (_: "/home/${username}")
|
||||
20
outputs/x86_64-linux/tests/home-manager/expr.nix
Normal file
20
outputs/x86_64-linux/tests/home-manager/expr.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"ai-hyprland"
|
||||
"ai-i3"
|
||||
"shoukei-hyprland"
|
||||
"shoukei-i3"
|
||||
"ruby"
|
||||
"k3s-prod-1-master-1"
|
||||
];
|
||||
in
|
||||
lib.genAttrs
|
||||
hosts
|
||||
(
|
||||
name: outputs.nixosConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
|
||||
)
|
||||
17
outputs/x86_64-linux/tests/hostname/expected.nix
Normal file
17
outputs/x86_64-linux/tests/hostname/expected.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
specialExpected = {
|
||||
"ai-hyprland" = "ai";
|
||||
"ai-i3" = "ai";
|
||||
"shoukei-hyprland" = "shoukei";
|
||||
"shoukei-i3" = "shoukei";
|
||||
};
|
||||
specialHostNames = builtins.attrNames specialExpected;
|
||||
|
||||
otherHosts = builtins.removeAttrs outputs.nixosConfigurations specialHostNames;
|
||||
otherHostsNames = builtins.attrNames otherHosts;
|
||||
# other hosts's hostName is the same as the nixosConfigurations name
|
||||
otherExpected = lib.genAttrs otherHostsNames (name: name);
|
||||
in (specialExpected // otherExpected)
|
||||
9
outputs/x86_64-linux/tests/hostname/expr.nix
Normal file
9
outputs/x86_64-linux/tests/hostname/expr.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}:
|
||||
lib.genAttrs
|
||||
(builtins.attrNames outputs.nixosConfigurations)
|
||||
(
|
||||
name: outputs.nixosConfigurations.${name}.config.networking.hostName
|
||||
)
|
||||
Reference in New Issue
Block a user