diff --git a/flake.nix b/flake.nix index 1b87b48a5..c0076e687 100644 --- a/flake.nix +++ b/flake.nix @@ -147,8 +147,8 @@ (pkgsFor.${system}) # hyprland-packages hyprland + hyprland-with-hyprtester hyprland-unwrapped - hyprtester # hyprland-extras xdg-desktop-portal-hyprland ; diff --git a/nix/default.nix b/nix/default.nix index a9d5c2d67..275727860 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -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"]; diff --git a/nix/hyprtester.nix b/nix/hyprtester.nix deleted file mode 100644 index 9e8d28776..000000000 --- a/nix/hyprtester.nix +++ /dev/null @@ -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"; - }; - }) diff --git a/nix/overlays.nix b/nix/overlays.nix index d67230d9c..8dcd35fd5 100644 --- a/nix/overlays.nix +++ b/nix/overlays.nix @@ -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 = diff --git a/nix/tests/default.nix b/nix/tests/default.nix index 5ef0eac8e..d7c000617 100644 --- a/nix/tests/default.nix +++ b/nix/tests/default.nix @@ -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