From 7e645125e96d880a8b2f34f8ac4e7acbb5522702 Mon Sep 17 00:00:00 2001
From: "P. R. d. O" <d.ol.rod@tutanota.com>
Date: Fri, 6 Jan 2023 11:31:13 -0600
Subject: [PATCH] rare: relax legendary-gl

Not able to run pythonRelaxDepsHook because of https://github.com/NixOS/nixpkgs/issues/198342: The wheel name start with Rare (capital letter).
---
 pkgs/games/rare/default.nix                | 20 +++++++++++++++++---
 pkgs/games/rare/legendary-gl-version.patch | 13 +++++++++++++
 2 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 pkgs/games/rare/legendary-gl-version.patch

diff --git a/pkgs/games/rare/default.nix b/pkgs/games/rare/default.nix
index 766673d3ea02..68ad3c872605 100644
--- a/pkgs/games/rare/default.nix
+++ b/pkgs/games/rare/default.nix
@@ -1,5 +1,15 @@
-{ lib, fetchFromGitHub, buildPythonApplication, qt5
-, legendary-gl, pypresence, pyqt5, python, qtawesome, requests, typing-extensions }:
+{ lib
+, fetchFromGitHub
+, buildPythonApplication
+, qt5
+, legendary-gl
+, pypresence
+, pyqt5
+, python
+, qtawesome
+, requests
+, typing-extensions
+}:
 
 buildPythonApplication rec {
   pname = "rare";
@@ -25,7 +35,11 @@ buildPythonApplication rec {
     typing-extensions
   ];
 
-  patches = [ ./fix-instance.patch ];
+  patches = [
+    ./fix-instance.patch
+    # Not able to run pythonRelaxDepsHook because of https://github.com/NixOS/nixpkgs/issues/198342
+    ./legendary-gl-version.patch
+  ];
 
   dontWrapQtApps = true;
 
diff --git a/pkgs/games/rare/legendary-gl-version.patch b/pkgs/games/rare/legendary-gl-version.patch
new file mode 100644
index 000000000000..bd7fa1af74f8
--- /dev/null
+++ b/pkgs/games/rare/legendary-gl-version.patch
@@ -0,0 +1,13 @@
+diff --git a/setup.py b/setup.py
+index 2416360..08de818 100644
+--- a/setup.py
++++ b/setup.py
+@@ -7,7 +7,7 @@ with open("README.md", "r") as fh:
+ 
+ requirements = [
+     "requests<3.0",
+-    "legendary-gl==0.20.31",
++    "legendary-gl~=0.20.31",
+     "setuptools",
+     "wheel",
+     "PyQt5",