diff --git a/pkgs/development/compilers/ghc/common-hadrian.nix b/pkgs/development/compilers/ghc/common-hadrian.nix
index 7974cba0824c..d9e10c96234a 100644
--- a/pkgs/development/compilers/ghc/common-hadrian.nix
+++ b/pkgs/development/compilers/ghc/common-hadrian.nix
@@ -171,11 +171,10 @@
# 9.8 and 9.10 don't run into this problem for some reason
|| (lib.versionAtLeast version "9.8" && lib.versionOlder version "9.11");
in
- [
- # Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
- (if lib.versionAtLeast version "9.8"
- then ./docs-sphinx-7-ghc98.patch
- else ./docs-sphinx-7.patch )
+
+ # Fix docs build with Sphinx >= 7 https://gitlab.haskell.org/ghc/ghc/-/issues/24129
+ lib.optionals (lib.versionOlder version "9.8") [
+ ./docs-sphinx-7.patch
]
++ lib.optionals (lib.versionAtLeast version "9.6" && lib.versionOlder version "9.6.6") [
(fetchpatch {
diff --git a/pkgs/development/compilers/ghc/docs-sphinx-7-ghc98.patch b/pkgs/development/compilers/ghc/docs-sphinx-7-ghc98.patch
deleted file mode 100644
index 3fc1a0f21561..000000000000
--- a/pkgs/development/compilers/ghc/docs-sphinx-7-ghc98.patch
+++ /dev/null
@@ -1,8 +0,0 @@
-Fix build of docs after sphinx update.
-https://github.com/sphinx-doc/sphinx/pull/11381
-https://gitlab.haskell.org/ghc/ghc/-/issues/24129
---- a/docs/users_guide/rtd-theme/layout.html
-+++ b/docs/users_guide/rtd-theme/layout.html
-@@ -28 +28 @@
--
-+