mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-10-29 11:22:47 +00:00
Nix: build hyprtester along with hyprland
This commit is contained in:
parent
7f06b7210e
commit
7d22a2df76
@ -147,8 +147,8 @@
|
||||
(pkgsFor.${system})
|
||||
# hyprland-packages
|
||||
hyprland
|
||||
hyprland-with-hyprtester
|
||||
hyprland-unwrapped
|
||||
hyprtester
|
||||
# hyprland-extras
|
||||
xdg-desktop-portal-hyprland
|
||||
;
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
commit,
|
||||
revCount,
|
||||
date,
|
||||
withHyprtester ? false,
|
||||
# deprecated flags
|
||||
enableNvidiaPatches ? false,
|
||||
nvidiaPatches ? false,
|
||||
@ -79,7 +80,7 @@ in
|
||||
fs.intersection
|
||||
# allows non-flake builds to only include files tracked by git
|
||||
(fs.gitTracked ../.)
|
||||
(fs.unions [
|
||||
(fs.unions (flatten [
|
||||
../assets/hyprland-portals.conf
|
||||
../assets/install
|
||||
../hyprctl
|
||||
@ -93,7 +94,8 @@ in
|
||||
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "desktop") ../example)
|
||||
(fs.fileFilter (file: file.hasExt "sh") ../scripts)
|
||||
(fs.fileFilter (file: file.name == "CMakeLists.txt") ../.)
|
||||
]);
|
||||
(optional withHyprtester ../hyprtester)
|
||||
]));
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
@ -185,8 +187,15 @@ in
|
||||
"NO_UWSM" = true;
|
||||
"NO_HYPRPM" = true;
|
||||
"TRACY_ENABLE" = false;
|
||||
"BUILD_HYPRTESTER" = withHyprtester;
|
||||
};
|
||||
|
||||
preConfigure = ''
|
||||
substituteInPlace hyprtester/CMakeLists.txt --replace-fail \
|
||||
"\''${CMAKE_CURRENT_BINARY_DIR}" \
|
||||
"${placeholder "out"}/bin"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
${optionalString wrapRuntimeDeps ''
|
||||
wrapProgram $out/bin/Hyprland \
|
||||
@ -197,6 +206,9 @@ in
|
||||
pkgconf
|
||||
]}
|
||||
''}
|
||||
'' + optionalString withHyprtester ''
|
||||
install hyprtester/pointer-warp -t $out/bin
|
||||
install hyprtester/pointer-scroll -t $out/bin
|
||||
'';
|
||||
|
||||
passthru.providedSessions = ["hyprland"];
|
||||
|
||||
@ -1,69 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvAdapters,
|
||||
cmake,
|
||||
pkg-config,
|
||||
hyprland,
|
||||
hyprwayland-scanner,
|
||||
version ? "git",
|
||||
}: let
|
||||
inherit (lib.lists) flatten foldl';
|
||||
inherit (lib.sources) cleanSourceWith cleanSource;
|
||||
inherit (lib.strings) hasSuffix cmakeBool;
|
||||
|
||||
adapters = flatten [
|
||||
stdenvAdapters.useMoldLinker
|
||||
stdenvAdapters.keepDebugInfo
|
||||
];
|
||||
|
||||
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
|
||||
in
|
||||
customStdenv.mkDerivation (finalAttrs: {
|
||||
pname = "hyprtester";
|
||||
inherit version;
|
||||
|
||||
src = cleanSourceWith {
|
||||
filter = name: _type: let
|
||||
baseName = baseNameOf (toString name);
|
||||
in
|
||||
! (hasSuffix ".nix" baseName);
|
||||
src = cleanSource ../.;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
pkg-config
|
||||
hyprwayland-scanner
|
||||
];
|
||||
|
||||
buildInputs = hyprland.buildInputs;
|
||||
|
||||
preConfigure = ''
|
||||
substituteInPlace hyprtester/CMakeLists.txt --replace-fail \
|
||||
"\''${CMAKE_CURRENT_BINARY_DIR}" \
|
||||
"${placeholder "out"}/bin"
|
||||
|
||||
cmake -S . -B .
|
||||
cmake --build . --target generate-protocol-headers -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
|
||||
cd hyprtester
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
install pointer-warp -t $out/bin
|
||||
install pointer-scroll -t $out/bin
|
||||
'';
|
||||
|
||||
cmakeBuildType = "Debug";
|
||||
|
||||
cmakeFlags = [(cmakeBool "TESTS" true)];
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/hyprwm/Hyprland";
|
||||
description = "Hyprland testing framework";
|
||||
license = lib.licenses.bsd3;
|
||||
platforms = hyprland.meta.platforms;
|
||||
mainProgram = "hyprtester";
|
||||
};
|
||||
})
|
||||
@ -43,9 +43,7 @@ in {
|
||||
};
|
||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||
|
||||
hyprtester = final.callPackage ./hyprtester.nix {
|
||||
inherit version;
|
||||
};
|
||||
hyprland-with-hyprtester = final.hyprland.override {withHyprtester = true;};
|
||||
|
||||
# deprecated packages
|
||||
hyprland-legacy-renderer =
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
inputs: pkgs: let
|
||||
flake = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
hyprland = flake.hyprland;
|
||||
hyprland = flake.hyprland-with-hyprtester;
|
||||
in {
|
||||
tests = pkgs.testers.runNixOSTest {
|
||||
name = "hyprland-tests";
|
||||
|
||||
nodes.machine = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
flake.hyprtester
|
||||
|
||||
# Programs needed for tests
|
||||
jq
|
||||
kitty
|
||||
@ -38,7 +36,7 @@ in {
|
||||
};
|
||||
|
||||
# Test configuration
|
||||
environment.etc."test.conf".source = "${flake.hyprtester}/share/hypr/test.conf";
|
||||
environment.etc."test.conf".source = "${hyprland}/share/hypr/test.conf";
|
||||
|
||||
# Disable portals
|
||||
xdg.portal.enable = pkgs.lib.mkForce false;
|
||||
@ -72,7 +70,7 @@ in {
|
||||
|
||||
# Run hyprtester testing framework/suite
|
||||
print("Running hyprtester")
|
||||
exit_status, _out = machine.execute("su - alice -c 'hyprtester -b ${hyprland}/bin/Hyprland -c /etc/test.conf -p ${flake.hyprtester}/lib/hyprtestplugin.so 2>&1 | tee /tmp/testerlog; exit ''${PIPESTATUS[0]}'")
|
||||
exit_status, _out = machine.execute("su - alice -c 'hyprtester -b ${hyprland}/bin/Hyprland -c /etc/test.conf -p ${hyprland}/lib/hyprtestplugin.so 2>&1 | tee /tmp/testerlog; exit ''${PIPESTATUS[0]}'")
|
||||
print(f"Hyprtester exited with {exit_status}")
|
||||
|
||||
# Copy logs to host
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user