diff --git a/pkgs/tools/graphics/goverlay/default.nix b/pkgs/tools/graphics/goverlay/default.nix new file mode 100644 index 000000000000..43d711588f8e --- /dev/null +++ b/pkgs/tools/graphics/goverlay/default.nix @@ -0,0 +1,108 @@ +{ lib +, writeScriptBin +, bash +, stdenv +, fetchFromGitHub +, fpc +, lazarus-qt +, qt5 +, libX11 +, libqt5pas +, coreutils +, git +, gnugrep +, libnotify +, mesa-demos +, polkit +, procps +, systemd +, vulkan-tools +, which +}: + +let + # Finds data files using the XDG Base Directory Specification + # See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + find-xdg-data-files = writeScriptBin "find-xdg-data-files" '' + #!${bash}/bin/sh + IFS=: + for xdg_data_dir in ''${XDG_DATA_HOME:-$HOME/.local/share}:''${XDG_DATA_DIRS:-/usr/local/share:/usr/share}; do + if [ -f "$xdg_data_dir/$1" ]; then + echo "$xdg_data_dir/$1" + fi + done + ''; +in stdenv.mkDerivation rec { + pname = "goverlay"; + version = "0.5.1"; + + src = fetchFromGitHub { + owner = "benjamimgois"; + repo = pname; + rev = version; + hash = "sha256-Zl1pq2MeGJsPdNlwUEpov5MHlsr9pSMkWHVprt8ImKs="; + }; + + outputs = [ "out" "man" ]; + + patches = [ + # Find MangoHud & vkBasalt Vulkan layers using the XDG Base Directory Specification + ./find-xdg-data-files.patch + ]; + + postPatch = '' + substituteInPlace Makefile \ + --replace 'prefix = /usr/local' "prefix = $out" + + substituteInPlace overlayunit.pas \ + --replace '/usr/share/icons/hicolor/128x128/apps/goverlay.png' "$out/share/icons/hicolor/128x128/apps/goverlay.png" + ''; + + nativeBuildInputs = [ + fpc + lazarus-qt + qt5.wrapQtAppsHook + ]; + + buildInputs = [ + libX11 + libqt5pas + ]; + + NIX_LDFLAGS = "--as-needed -rpath ${lib.makeLibraryPath buildInputs}"; + + buildPhase = '' + runHook preBuild + HOME=$(mktemp -d) lazbuild --lazarusdir=${lazarus-qt}/share/lazarus -B goverlay.lpi + runHook postBuild + ''; + + qtWrapperArgs = [ + "--prefix PATH : ${lib.makeBinPath [ + bash + coreutils + find-xdg-data-files + git + gnugrep + libnotify + mesa-demos + polkit + procps + systemd + vulkan-tools + which + ]}" + + # Force xcb since libqt5pas doesn't support Wayland + # See https://github.com/benjamimgois/goverlay/issues/107 + "--set QT_QPA_PLATFORM xcb" + ]; + + meta = with lib; { + description = "An opensource project that aims to create a Graphical UI to help manage Linux overlays"; + homepage = "https://github.com/benjamimgois/goverlay"; + license = licenses.gpl3Plus; + maintainers = with maintainers; [ kira-bruneau ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/tools/graphics/goverlay/find-xdg-data-files.patch b/pkgs/tools/graphics/goverlay/find-xdg-data-files.patch new file mode 100644 index 000000000000..862e4c3903cb --- /dev/null +++ b/pkgs/tools/graphics/goverlay/find-xdg-data-files.patch @@ -0,0 +1,40 @@ +diff --git a/overlayunit.pas b/overlayunit.pas +index 59f6a81..a096543 100644 +--- a/overlayunit.pas ++++ b/overlayunit.pas +@@ -4871,7 +4871,7 @@ begin + //Determine Mangohud dependency status + + //locate MangoHud and store result in tmp folder +- RunCommand('bash -c ''find /usr/share/vulkan/implicit_layer.d/MangoHud.json >> /tmp/goverlay/dependency_mangohud''', s); ++ RunCommand('bash -c ''find-xdg-data-files vulkan/implicit_layer.d/MangoHud.json >> /tmp/goverlay/dependency_mangohud''', s); + + // Assign Text file dependency_mangohud to variable mangohudVAR + AssignFile(mangohudVAR, '/tmp/goverlay/dependency_mangohud'); +@@ -4880,7 +4880,7 @@ begin + CloseFile(mangohudVAR); + + // Read String and store value on mangohuddependencyVALUE based on result +- if mangohudSTR = '/usr/share/vulkan/implicit_layer.d/MangoHud.json' then ++ if mangohudSTR <> '' then + mangohuddependencyVALUE := 1 + else + mangohuddependencyVALUE := 0; +@@ -4889,7 +4889,7 @@ begin + //Determine vkBasalt dependency staus + + //locate vkBasalt and store result in tmp folder +- RunCommand('bash -c ''find /usr/share/vulkan/implicit_layer.d/vkBasalt.json >> /tmp/goverlay/dependency_vkbasalt''', s); ++ RunCommand('bash -c ''find-xdg-data-files vulkan/implicit_layer.d/vkBasalt.json >> /tmp/goverlay/dependency_vkbasalt''', s); + + // Assign Text file dependency_mangohud to variable mangohudVAR + AssignFile(vkbasaltVAR, '/tmp/goverlay/dependency_vkbasalt'); +@@ -4898,7 +4898,7 @@ begin + CloseFile(vkbasaltVAR); + + // Read String and store value on vkbasaltdependencyVALUE based on result +- if vkbasaltSTR = '/usr/share/vulkan/implicit_layer.d/vkBasalt.json' then ++ if vkbasaltSTR <> '' then + vkbasaltdependencyVALUE := 1 + else + vkbasaltdependencyVALUE := 0; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8c30667e4e40..9d8f12bff6d7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5371,6 +5371,8 @@ in govc = callPackage ../tools/virtualization/govc { }; + goverlay = callPackage ../tools/graphics/goverlay { }; + gpart = callPackage ../tools/filesystems/gpart { }; gparted = callPackage ../tools/misc/gparted { };