From c114be4ebd065beeac5eebf192089fb8aca2700a Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Tue, 22 Oct 2024 20:56:38 -0400 Subject: [PATCH] gamescope --- home/home.scm | 1 + modules/freya/packages/wm.scm | 198 ++++++++++++++++++++++++++++++---- 2 files changed, 179 insertions(+), 20 deletions(-) diff --git a/home/home.scm b/home/home.scm index 67cc6f5..f47741f 100644 --- a/home/home.scm +++ b/home/home.scm @@ -124,6 +124,7 @@ easyeffects firefox-wayland-new librewolf-new + gamescope ; gtk lavanda-gtk-theme diff --git a/modules/freya/packages/wm.scm b/modules/freya/packages/wm.scm index 4235657..5c99212 100644 --- a/modules/freya/packages/wm.scm +++ b/modules/freya/packages/wm.scm @@ -1,12 +1,30 @@ (define-module (freya packages wm) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) + #:use-module (gnu packages gl) #:use-module (gnu packages wm) + #:use-module (gnu packages stb) + #:use-module (gnu packages gcc) + #:use-module (gnu packages sdl) + #:use-module (gnu packages xorg) + #:use-module (gnu packages xdisorg) + #:use-module (gnu packages maths) + #:use-module (gnu packages image) + #:use-module (gnu packages cmake) + #:use-module (gnu packages linux) + #:use-module (gnu packages vulkan) + #:use-module (gnu packages python) + #:use-module (gnu packages pciutils) + #:use-module (gnu packages benchmark) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages freedesktop) + #:use-module (gnu packages version-control) #:use-module (guix download) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix git-download) #:use-module (guix build utils) + #:use-module (guix build-system meson) #:use-module (guix utils)) @@ -44,23 +62,163 @@ #:configure-flags #~(list "--wrap-mode=nodownload" "-Dexperimental=true"))))) -;(define-public libliftoff -; (package -; (name "libliftoff") -; (version "0.1.0") -; (source (origin -; (method url-fetch) -; (uri (string-append "https://github.com/emersion/libliftoff" -; "/archive/refs/tags/v" version ".tar.gz")) -; (sha256 -; (base32 -; "17ssbjbv8njgvfha8zsx4nixpi5xxl1rwvk0lcacgqk0nmjyb23s")))) -; (build-system meson-build-system) -; (native-inputs (list gcc-13 -; pkg-config -; cmake-minimal-3.30.0 -; libdrm)) -; (home-page "https://github.com/emersion/libliftoff") -; (synopsis "Lightweight KMS plane library") -; (description "") -; (license license:expat))) +(define-public vkroots + (let ((commit "d5ef31abc7cb5c69aee4bcb67b10dd543c1ff7ac")) + (package + (name "vkroots") + (version (git-version "" "0" commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/misyltoad/vkroots") + (commit commit))) + (sha256 + (base32 + "0g2mh8l0xzxzr4yjyafzv76n7jk9043dcbf5mpqwpwmjx88m5nc0")) + (file-name (git-file-name name version)))) + (arguments (list + #:phases #~(modify-phases %standard-phases + (add-after 'unpack 'patch-vulkan + (lambda _ + (substitute* "gen/make_vkroots" + (("\\.\\.") (getcwd))))) + (add-before 'install 'gen-vkroots + (lambda _ + (invoke "python3" + "../source/gen/make_vkroots" + "-x" + (string-append + #$(this-package-native-input "vulkan-headers") + "/share/vulkan/registry/vk.xml"))))))) + (build-system meson-build-system) + (native-inputs (list python vulkan-headers)) + (home-page "https://github.com/misyltoad/vkroots") + (description "A stupid simple method of making Vulkan layers, at home! ") + (synopsis "A stupid simple method of making Vulkan layers, at home! ") + (license license:expat)))) + + +(define-public libliftoff-0.4 + (package + (inherit libliftoff) + (name "libliftoff") + (version "0.4.1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://gitlab.freedesktop.org/emersion/libliftoff") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1ikjp638d655ycaqkdnzhb12d29kkbb3a46lqhbhsfc8vsqj3z1l")))))) + + +(define reshade-for-gamescope + (let ((commit "4245743a8c41abbe3dc73980c1810fe449359bf1")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Joshua-Ashton/reshade") + (commit commit))) + (file-name (git-file-name "reshade" commit)) + (sha256 + (base32 "1bb5392dfiri8nrxvck1w2jxva8m9xzrgi16rvnvg96l493a538y"))))) + + +(define-public gamescope + (package + (name "gamescope") + (version "3.14.2") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/ValveSoftware/gamescope") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0x7gh1rr2ismqfkaa4wm7025acjpgmims41iwzdcps5pg8nxmmhh")))) + (build-system meson-build-system) + (arguments + (list #:configure-flags #~(list "-Dpipewire=enabled" + "-Denable_openvr_support=false" + "-Dforce_fallback_for=[]" + (string-append "-Dc_args=-DHWDATA_PNP_IDS=\"" + #$(this-package-native-input "hwdata") + "/share/hwdata/pnp.ids\"")) + #:tests? #f + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'patch-deps + (lambda _ + ; copy reshade + (delete-file-recursively "src/reshade") + (copy-recursively #$reshade-for-gamescope "src/reshade") + ; path /usr + (substitute* "src/reshade_effect_manager.cpp" + (("/usr") #$output)) + ; path meson.build + (substitute* "src/meson.build" + ;; patch stb + (("dependency\\('stb'\\)") + (format #f "declare_dependency(include_directories: ['~a'])" + (string-join + '#$(map (lambda (label) (this-package-native-input label)) + (list "stb-image" + "stb-image-resize" + "stb-image-write")) + "','"))) + ;; patch libdisplay-info + (("< 0.2.0") + (string-append "<= " #$(package-version (this-package-input "libdisplay-info")))) + ;(("reshade/") (string-append #$reshade-for-gamescope "/")) + (("../thirdparty/SPIRV-Headers") #$(this-package-native-input "spirv-headers"))) + ;; include and + (substitute* (find-files "src" "\\.hpp$") + (("#pragma once" pragma) + (string-append pragma + "\n#include " + "\n#include "))) + ))))) + (native-inputs (list gcc-13 + benchmark + glslang + hwdata + pkg-config + stb-image + stb-image-resize + stb-image-write + spirv-headers + vkroots + vulkan-headers + wayland-protocols)) + (inputs (list gcc-13 + glm + libavif + libcap + libdisplay-info + libdrm + libinput + libliftoff-0.4 + libx11 + libxcomposite + libxcursor + libxdamage + libxext + libxkbcommon + libxmu + libxrender + libxres + libxt + libxtst + pipewire + sdl2 + vulkan-loader + wayland + wlroots)) + (home-page "https://github.com/ValveSoftware/gamescope") + (description "SteamOS session compositing window manager") + (synopsis "SteamOS session compositing window manager") + (license license:bsd-2)))