diff --git a/patches/derive-lifted-instances-0.2.2.patch b/patches/derive-lifted-instances-0.2.2.patch
new file mode 100644
index 0000000000000000000000000000000000000000..7929d3910fcc8251f89c5993e073e4fb7b310f9a
--- /dev/null
+++ b/patches/derive-lifted-instances-0.2.2.patch
@@ -0,0 +1,15 @@
+diff --git a/Data/DeriveLiftedInstances/Internal.hs b/Data/DeriveLiftedInstances/Internal.hs
+index 7816a59..3429941 100644
+--- a/Data/DeriveLiftedInstances/Internal.hs
++++ b/Data/DeriveLiftedInstances/Internal.hs
+@@ -148,8 +148,10 @@ contains :: Data d => Name -> d -> Bool
+ contains nm = gmapQl (||) False (\d -> maybe (contains nm d) (== nm) $ cast d)
+ 
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ deriving instance Lift Fixity
+ deriving instance Lift FixityDirection
++#endif
+ 
+ -- | Helper for showing infix expressions
+ data ShowsPrec = ShowsPrec (Int -> String -> String) | ShowOp2 Fixity (Int -> String -> String) | ShowOp1 Fixity (Int -> String -> String)
diff --git a/patches/th-lift-0.8.4.patch b/patches/th-lift-0.8.4.patch
new file mode 100644
index 0000000000000000000000000000000000000000..ffa6d34462f8593a6bd8fedccfca1a1b29af0924
--- /dev/null
+++ b/patches/th-lift-0.8.4.patch
@@ -0,0 +1,59 @@
+diff --git a/src/Language/Haskell/TH/Lift.hs b/src/Language/Haskell/TH/Lift.hs
+index 98d25b4..ef9efcc 100644
+--- a/src/Language/Haskell/TH/Lift.hs
++++ b/src/Language/Haskell/TH/Lift.hs
+@@ -264,30 +264,39 @@ typeDataError dataName = fail
+   $ ""
+ #endif
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift Name where
+   lift (Name occName nameFlavour) = [| Name occName nameFlavour |]
+ #if MIN_VERSION_template_haskell(2,16,0)
+   liftTyped = unsafeSpliceCoerce . lift
+ #endif
++#endif
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift OccName where
+   lift n = [| mkOccName |] `appE` lift (occString n)
+ #if MIN_VERSION_template_haskell(2,16,0)
+   liftTyped = unsafeSpliceCoerce . lift
+ #endif
++#endif
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift PkgName where
+   lift n = [| mkPkgName |] `appE` lift (pkgString n)
+ #if MIN_VERSION_template_haskell(2,16,0)
+   liftTyped = unsafeSpliceCoerce . lift
+ #endif
++#endif
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift ModName where
+   lift n = [| mkModName |] `appE` lift (modString n)
+ #if MIN_VERSION_template_haskell(2,16,0)
+   liftTyped = unsafeSpliceCoerce . lift
+ #endif
++#endif
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift NameFlavour where
+   lift NameS = [| NameS |]
+   lift (NameQ modnam) = [| NameQ modnam |]
+@@ -305,7 +314,9 @@ instance Lift NameFlavour where
+ #if MIN_VERSION_template_haskell(2,16,0)
+   liftTyped = unsafeSpliceCoerce . lift
+ #endif
++#endif
+ 
++#if !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift NameSpace where
+   lift VarName = [| VarName |]
+   lift DataName = [| DataName |]
+@@ -316,3 +327,4 @@ instance Lift NameSpace where
+ #if MIN_VERSION_template_haskell(2,16,0)
+   liftTyped = unsafeSpliceCoerce . lift
+ #endif
++#endif
diff --git a/patches/th-orphans-0.13.14.patch b/patches/th-orphans-0.13.14.patch
new file mode 100644
index 0000000000000000000000000000000000000000..6196b83346aae601fd913ade149647f4a0e9a7df
--- /dev/null
+++ b/patches/th-orphans-0.13.14.patch
@@ -0,0 +1,22 @@
+diff --git a/src/Language/Haskell/TH/Instances.hs b/src/Language/Haskell/TH/Instances.hs
+index 488fab5..27ee15c 100644
+--- a/src/Language/Haskell/TH/Instances.hs
++++ b/src/Language/Haskell/TH/Instances.hs
+@@ -121,7 +121,7 @@ import qualified Generics.Deriving.TH as Generic (deriveAll)
+ import qualified Control.Monad.Fail as Fail
+ #endif
+ 
+-#if MIN_VERSION_template_haskell(2,16,0)
++#if MIN_VERSION_template_haskell(2,16,0) && !MIN_VERSION_template_haskell(2,22,1)
+ import GHC.Ptr (Ptr(Ptr))
+ import GHC.ForeignPtr (newForeignPtr_)
+ import Language.Haskell.TH.Syntax.Compat (liftTypedFromUntypedSplice)
+@@ -435,7 +435,7 @@ deriving instance Typeable Ppr
+ deriving instance Typeable Quasi
+ #endif
+ 
+-#if MIN_VERSION_template_haskell(2,16,0)
++#if MIN_VERSION_template_haskell(2,16,0) && !MIN_VERSION_template_haskell(2,22,1)
+ instance Lift Bytes where
+   lift bytes =
+     [| Bytes