From d60892df98d76b853c5c55b99bab542654ec6499 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 30 May 2022 14:52:56 +0200 Subject: [PATCH] packages: Add gamescope --- .../wayfire/firedecor/default.nix | 27 +++++++++ packages/default.nix | 33 ++++++++++ packages/tools/games/gamescope/default.nix | 60 +++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 packages/applications/wayfire/firedecor/default.nix create mode 100644 packages/tools/games/gamescope/default.nix diff --git a/packages/applications/wayfire/firedecor/default.nix b/packages/applications/wayfire/firedecor/default.nix new file mode 100644 index 0000000..af7816a --- /dev/null +++ b/packages/applications/wayfire/firedecor/default.nix @@ -0,0 +1,27 @@ +{ + lib, stdenv +, fetchFromGitHub +, wayfire, wf-config, librsvg, boost, wlroots, pango, wayland, libxkbcommon, systemd, libinput +, meson, pkg-config, cmake, ninja +}: + +stdenv.mkDerivation { + pname = "firedecor"; + version = "20220519"; + + src = fetchFromGitHub { + owner = "AhoyISki"; + repo = "Firedecor"; + rev = "0170c4df209f0226295a9e2aa3cae782d9861908"; + sha256 = "0a8vc4l3az14l8piwzqgfqsdv16kakcvcznvw6q1dgb2sf97zdlv"; + }; + + nativeBuildInputs = [ meson pkg-config cmake ninja ]; + + buildInputs = [ wayfire librsvg boost wf-config wlroots pango wayland libxkbcommon systemd libinput ]; + + patchPhase = '' + sed -e "s|wayfire.get_variable(pkgconfig: 'plugindir')|'$out/usr/lib/wayfire'|" --in-place src/meson.build + sed -e "s|wayfire.get_variable(pkgconfig: 'metadatadir')|'$out/usr/lib/wayfire'|" --in-place metadata/meson.build + ''; +} diff --git a/packages/default.nix b/packages/default.nix index eb220fd..768919f 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -10,6 +10,33 @@ let extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland"; #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; }; + wf-config_0_8 = prev.wf-config.overrideAttrs (old: { + version = "0.8-git"; + src = prev.fetchFromGitHub { + owner = "wayfirewm"; + repo = "wf-config"; + rev = "e42a3870fb194842a505ad5a9671be1aebda0b0b"; + sha256 = "0n6i3hizbqixxjh33950ya8avwqil5k94jbgff1pimcbh9ahpgrr"; + }; + }); + wayfire-master = (prev.wayfireApplications-unwrapped.wayfire.overrideAttrs (old: { + version = "0.8.0-20220526"; + src = prev.fetchgit { + url = "https://github.com/WayfireWM/wayfire.git"; + rev = "5dbf0d0fd8ec46cf112f05fb63057f5b6d06b10d"; + sha256 = "sha256-ZeaNSlDHoiLnRlHKk14meDbrizIz+nm3iYl90vvo2Ps="; + fetchSubmodules = true; + }; + + buildInputs = (map + # Override wlroots with wlroots_0_15 + (x: if (prev.lib.getName x) == "wlroots" + then prev.wlroots_0_15 + else x + ) old.buildInputs) ++ [ prev.pango prev.libevdev prev.nlohmann_json ]; + })).override { + wf-config = wf-config_0_8; + }; in { inherit discord-system-electron; @@ -69,4 +96,10 @@ in { zoom-vm = prev.callPackage scripts/zoom-vm {}; razer-cli = prev.callPackage tools/hardware/razer-cli {}; + + gamescope = prev.callPackage tools/games/gamescope {}; + + wayfire-firedecor = prev.callPackage applications/wayfire/firedecor { + wayfire = wayfire-master; + }; } diff --git a/packages/tools/games/gamescope/default.nix b/packages/tools/games/gamescope/default.nix new file mode 100644 index 0000000..11a2dc6 --- /dev/null +++ b/packages/tools/games/gamescope/default.nix @@ -0,0 +1,60 @@ +{ lib, stdenv, fetchFromGitHub, meson, pkgconfig, libdrm, xorg +, wayland, wayland-protocols, libxkbcommon, libcap +, SDL2, mesa, libinput, pixman, xcbutilerrors, xcbutilwm, glslang +, ninja, makeWrapper, xwayland, libuuid, xcbutilrenderutil +, pipewire, stb, writeText, wlroots, vulkan-loader, vulkan-headers }: + +let + stbpc = writeText "stbpc" '' + prefix=${stb} + includedir=''${prefix}/include/stb + Cflags: -I''${includedir} + Name: stb + Version: ${stb.version} + Description: stb + ''; + stb_ = stb.overrideAttrs (oldAttrs: rec { + installPhase = '' + ${oldAttrs.installPhase} + install -Dm644 ${stbpc} $out/lib/pkgconfig/stb.pc + ''; + }); +in stdenv.mkDerivation rec { + pname = "gamescope"; + version = "3.9.1"; + + src = fetchFromGitHub { + owner = "Plagman"; + repo = "gamescope"; + rev = version; + sha256 = "05a1sj1fl9wpb9jys515m96958cxmgim8i7zc5mn44rjijkfbfcb"; + fetchSubmodules = true; + }; + + preConfigure = '' + substituteInPlace meson.build \ + --replace "'examples=false'" "'examples=false', 'logind-provider=systemd', 'libseat=disabled'" + ''; + + postInstall = '' + wrapProgram $out/bin/gamescope \ + --prefix PATH : "${lib.makeBinPath [ xwayland ]}" + ''; + + buildInputs = with xorg; [ + libX11 libXdamage libXcomposite libXrender libXext libXxf86vm + libXtst libdrm vulkan-loader wayland wayland-protocols + libxkbcommon libcap SDL2 mesa libinput pixman xcbutilerrors + xcbutilwm libXi libXres libuuid xcbutilrenderutil xwayland + pipewire wlroots + ]; + nativeBuildInputs = [ meson pkgconfig glslang ninja makeWrapper stb_ ]; + + meta = with lib; { + description = "The micro-compositor formerly known as steamcompmgr"; + license = licenses.bsd2; + homepage = src.meta.homepage; + platforms = platforms.linux; + maintainers = with maintainers; [ ]; + }; +}