diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/ghc-tags-plugin.cabal b/ghc-tags-plugin.cabal
--- a/ghc-tags-plugin.cabal
+++ b/ghc-tags-plugin.cabal
@@ -1,6 +1,6 @@
 cabal-version:       2.4
 name:                ghc-tags-plugin
-version:             0.2.0.0
+version:             0.2.1.0
 synopsis:            A compiler plugin which generates tags file from GHC parsed syntax tree.
 description:
   A [GHC compiler plugin](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/extending_ghc.html?highlight=compiler%20plugin#compiler-plugins)
@@ -54,9 +54,6 @@
                        text             ^>=1.2,
 
                        ghc-tags-core
-
-  if !os(windows)
-    build-depends:     unix              >=2.7.2.2 && < 2.8
 
   default-language:    Haskell2010
   ghc-options:         -Wall
diff --git a/lib/Plugin/GhcTags.hs b/lib/Plugin/GhcTags.hs
--- a/lib/Plugin/GhcTags.hs
+++ b/lib/Plugin/GhcTags.hs
@@ -34,8 +34,8 @@
 #if !defined(mingw32_HOST_OS)
 import           Foreign.C.Types (CInt (..))
 import           Foreign.C.Error (throwErrnoIfMinus1_)
-import           System.Posix.Types (Fd (..))
-import           System.Posix.IO (handleToFd)
+import           GHC.IO.FD (FD (..))
+import           GHC.IO.Handle.FD (handleToFd)
 #endif
 
 import           Options.Applicative.Types (ParserFailure (..))
@@ -430,11 +430,11 @@
 #if !defined(mingw32_HOST_OS)
 hDataSync ::  Handle -> IO ()
 hDataSync h = do
-    fd <- handleToFd h
-    throwErrnoIfMinus1_ "ghc-tags-plugin" (c_fdatasync fd)
+    FD { fdFD } <- handleToFd h
+    throwErrnoIfMinus1_ "ghc-tags-plugin" (c_fdatasync fdFD)
 
 foreign import ccall safe "fdatasync"
-    c_fdatasync :: Fd -> IO CInt 
+    c_fdatasync :: CInt -> IO CInt 
 #else
 hDataSync :: Handle -> IO ()
 hDataSync _ = pure ()
