mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 11:01:15 +00:00
flake: add machine tests
This commit is contained in:
parent
a777941eed
commit
3aa02e8524
5 changed files with 97 additions and 0 deletions
|
@ -14,6 +14,8 @@
|
|||
imports = [
|
||||
# add lib to module args
|
||||
{_module.args = {inherit (nixpkgs) lib;};}
|
||||
|
||||
./flake/tests # machine tests for nvf
|
||||
./flake/apps.nix
|
||||
./flake/legacyPackages.nix
|
||||
./flake/overlays.nix
|
||||
|
|
28
flake/tests/checks/homeManagerModule.nix
Normal file
28
flake/tests/checks/homeManagerModule.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
inputs,
|
||||
nixosTest,
|
||||
homeManagerModules,
|
||||
...
|
||||
}:
|
||||
nixosTest {
|
||||
name = "home-manager-test";
|
||||
|
||||
nodes.machine = {
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
../profiles/minimal.nix
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
sharedModules = [
|
||||
homeManagerModules.nvf
|
||||
];
|
||||
|
||||
users.test = {
|
||||
programs.nvf.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = "";
|
||||
}
|
19
flake/tests/checks/nixosModule.nix
Normal file
19
flake/tests/checks/nixosModule.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
nixosTest,
|
||||
nixosModules,
|
||||
...
|
||||
}:
|
||||
nixosTest {
|
||||
name = "home-manager-test";
|
||||
|
||||
nodes.machine = {
|
||||
imports = [
|
||||
nixosModules.nvf
|
||||
../profiles/minimal.nix
|
||||
];
|
||||
|
||||
programs.nvf.enable = true;
|
||||
};
|
||||
|
||||
testScript = "";
|
||||
}
|
31
flake/tests/default.nix
Normal file
31
flake/tests/default.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}: let
|
||||
inherit (lib.filesystem) packagesFromDirectoryRecursive;
|
||||
inherit (lib.customisation) callPackageWith;
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
|
||||
defaultInherits = {
|
||||
inherit (config.flake) homeManagerModules nixosModules;
|
||||
inherit inputs;
|
||||
};
|
||||
|
||||
callPackage = callPackageWith (recursiveUpdate pkgs defaultInherits);
|
||||
in {
|
||||
checks = packagesFromDirectoryRecursive {
|
||||
inherit callPackage;
|
||||
directory = ./checks;
|
||||
};
|
||||
|
||||
# expose checks as packages to be built
|
||||
packages.test = self'.checks.home-manager-test.driverInteractive;
|
||||
};
|
||||
}
|
17
flake/tests/profiles/minimal.nix
Normal file
17
flake/tests/profiles/minimal.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
# he's a thicc boi
|
||||
virtualisation = {
|
||||
cores = 2;
|
||||
memorySize = 2048;
|
||||
qemu.options = ["-vga none -enable-kvm -device virtio-gpu-pci,xres=720,yres=1440"];
|
||||
};
|
||||
|
||||
users.users.test = {
|
||||
isNormalUser = true;
|
||||
password = "";
|
||||
};
|
||||
|
||||
home-manager.sharedModules = [
|
||||
{home.stateVersion = "24.05";}
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue