From 5c4696df8a3daea0d5a00380267406ef45ef980c Mon Sep 17 00:00:00 2001
From: Doron Behar <doron.behar@gmail.com>
Date: Fri, 30 Jun 2023 13:15:36 +0300
Subject: [PATCH] coeurl: Add upstream commits that fix build

---
 pkgs/development/libraries/coeurl/default.nix | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/pkgs/development/libraries/coeurl/default.nix b/pkgs/development/libraries/coeurl/default.nix
index 4d04abee3adc..9e779dea6d89 100644
--- a/pkgs/development/libraries/coeurl/default.nix
+++ b/pkgs/development/libraries/coeurl/default.nix
@@ -1,6 +1,7 @@
 { lib
 , stdenv
 , fetchFromGitLab
+, fetchpatch
 , ninja
 , pkg-config
 , meson
@@ -20,6 +21,22 @@ stdenv.mkDerivation rec {
     rev = "v${version}";
     hash = "sha256-sN+YSddUOdnJLcnHyWdjNm1PpxCwnkwiqSvyrwUrg6w=";
   };
+  patches = [
+    # Fix compatibility issues with curl > 7.85, see:
+    # https://nheko.im/nheko-reborn/coeurl/-/commit/d926893007c353fbc149d8538a5762ca8384273a
+    # PATCH CAN BE REMOVED AFTER 0.3.0
+    (fetchpatch {
+      url = "https://nheko.im/nheko-reborn/coeurl/-/commit/d926893007c353fbc149d8538a5762ca8384273a.patch";
+      hash = "sha256-hOBk7riuVI7k7qe/SMq3XJnFzyZ0gB9kVG7dKvWOsPY=";
+    })
+    # Fix error when building with fmt >= 10, see:
+    # https://nheko.im/nheko-reborn/coeurl/-/commit/831e2ee8e9cf08ea1ee9736cde8370f9d0312abc
+    # PATCH CAN BE REMOVED AFTER 0.3.0
+    (fetchpatch {
+      url = "https://nheko.im/nheko-reborn/coeurl/-/commit/831e2ee8e9cf08ea1ee9736cde8370f9d0312abc.patch";
+      hash = "sha256-a52Id7Nm3Mmmwv7eL58j6xovjlkpAO4KahVM/Q3H65w=";
+    })
+  ];
 
   nativeBuildInputs = [ ninja pkg-config meson ];