add test/debug VM capability

This commit is contained in:
nek0 2023-08-24 03:51:18 +02:00 committed by Amedeo Molnár
parent d9b7c48953
commit 0cb8bd8363
2 changed files with 59 additions and 4 deletions

View file

@ -11,6 +11,8 @@
let
pkgs = nixpkgs.legacyPackages.${system};
nixos-lib = import (nixpkgs + "/nixos/lib") {};
haskellPackages = pkgs.haskellPackages;
jailbreakUnbreak = pkg:
@ -18,14 +20,21 @@
packageName = "vulkan-tutorial";
in rec {
packages.${packageName} = # (ref:haskell-package-def)
haskellPackages.callCabal2nix packageName self rec {
# Dependency overrides go here
wavefront = jailbreakUnbreak haskellPackages.wavefront;
packages = rec {
vulkan-tutorial = # (ref:haskell-package-def)
haskellPackages.callCabal2nix packageName self rec {
# Dependency overrides go here
wavefront = jailbreakUnbreak haskellPackages.wavefront;
};
test = import ./test.nix {inherit pkgs vulkan-tutorial;};
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 {
packages = p: [ defaultPackage ];
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()
'';
})