add test/debug VM capability

This commit is contained in:
nek0 2023-08-24 03:51:18 +02:00
parent 4dcf5ba486
commit acd8fe16c6
2 changed files with 59 additions and 4 deletions

View file

@ -11,6 +11,8 @@
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
nixos-lib = import (nixpkgs + "/nixos/lib") {};
haskellPackages = pkgs.haskellPackages; haskellPackages = pkgs.haskellPackages;
jailbreakUnbreak = pkg: jailbreakUnbreak = pkg:
@ -18,14 +20,21 @@
packageName = "vulkan-tutorial"; packageName = "vulkan-tutorial";
in rec { in rec {
packages.${packageName} = # (ref:haskell-package-def) packages = rec {
haskellPackages.callCabal2nix packageName self rec { vulkan-tutorial = # (ref:haskell-package-def)
# Dependency overrides go here haskellPackages.callCabal2nix packageName self rec {
wavefront = jailbreakUnbreak haskellPackages.wavefront; # Dependency overrides go here
wavefront = jailbreakUnbreak haskellPackages.wavefront;
}; };
test = import ./test.nix {inherit pkgs vulkan-tutorial;};
defaultPackage = self.packages.${system}.${packageName}; defaultPackage = self.packages.${system}.${packageName};
checks = {
test = import ./test.nix {inherit pkgs; vulkan-tutorial = packages.vulkan-tutorial;};
#test = flake-utils.lib.mkApp ({ drv = self.packages.${system}.test; });
};
devShell = haskellPackages.shellFor { devShell = haskellPackages.shellFor {
packages = p: [ defaultPackage ]; packages = p: [ defaultPackage ];
withHoogle = true; withHoogle = true;

46
test.nix Normal file
View file

@ -0,0 +1,46 @@
{pkgs, vulkan-tutorial, ...}:
pkgs.nixosTest ({
name = "test";
nodes = {
machine = { config, pkgs, ...}: {
environment = {
systemPackages = with pkgs; [
vulkan-tutorial
git
shaderc
vulkan-loader
vulkan-validation-layers
];
sessionVariables = {
VK_LAYER_PATH="${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
SDL_VULKAN_LIBRARY="${pkgs.vulkan-loader}/lib/libvulkan.so";
};
};
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver = {
enable = true;
displayManager.sddm.enable = true;
desktopManager.cinnamon.enable = true;
};
users.users.test = {
password = "test";
extraGroups = [
"wheel"
];
isNormalUser = true;
};
};
};
skipLint = true;
testScript = ''
start_all()
machine.shell_interact()
'';
})