diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,17 @@
 
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
+
+## 0.2.0.1 - 2022-03-07
+
+### Fixed
+
+ - Build with newer Nix versions 2.5, 2.6
+
+### Added
+
+ - Improved conditional code support with `cabal-pkg-config-version-hook`
+
 ## 0.2.0.0 - 2021-06-22
 
 ### Added
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,13 @@
+import Data.Function ((&))
+import Distribution.PkgConfigVersionHook as PV
+import Distribution.Simple
+
+main :: IO ()
+main =
+  defaultMainWithHooks $
+    simpleUserHooks
+      & PV.addHook
+        (PV.mkSettings "nix-store")
+          { PV.macroName = "NIX",
+            PV.flagPrefixName = "nix"
+          }
diff --git a/hercules-ci-cnix-expr.cabal b/hercules-ci-cnix-expr.cabal
--- a/hercules-ci-cnix-expr.cabal
+++ b/hercules-ci-cnix-expr.cabal
@@ -1,7 +1,7 @@
 cabal-version: 2.4
 
 name:           hercules-ci-cnix-expr
-version:        0.2.0.0
+version:        0.2.0.1
 synopsis:       Bindings for the Nix evaluator
 category:       Nix, CI, Testing, DevOps
 homepage:       https://docs.hercules-ci.com
@@ -10,7 +10,7 @@
 maintainer:     info@hercules-ci.com
 copyright:      2018-2021 Hercules CI
 license:        Apache-2.0
-build-type:     Simple
+build-type:     Custom
 extra-source-files:
     CHANGELOG.md
 
@@ -43,6 +43,12 @@
       -optc-Wall
     if os(darwin)
       ghc-options: -pgmc=clang++
+
+custom-setup
+  setup-depends:
+    base
+    , Cabal >= 2.2.0.0
+    , cabal-pkg-config-version-hook
 
 
 library
diff --git a/src/Hercules/CNix/Expr.hs b/src/Hercules/CNix/Expr.hs
--- a/src/Hercules/CNix/Expr.hs
+++ b/src/Hercules/CNix/Expr.hs
@@ -30,7 +30,6 @@
 import qualified Language.C.Inline.Cpp as C
 import qualified Language.C.Inline.Cpp.Exceptions as C
 import Protolude hiding (evalState, throwIO)
-import qualified UnliftIO
 
 C.context (Hercules.CNix.Store.Context.context <> Hercules.CNix.Expr.Context.evalContext)
 
@@ -55,8 +54,6 @@
 C.include "<nix/get-drvs.hh>"
 
 C.include "<nix/derivations.hh>"
-
-C.include "<nix/affinity.hh>"
 
 C.include "<nix/globals.hh>"
 
diff --git a/src/Hercules/CNix/Expr/Typed.hs b/src/Hercules/CNix/Expr/Typed.hs
--- a/src/Hercules/CNix/Expr/Typed.hs
+++ b/src/Hercules/CNix/Expr/Typed.hs
@@ -38,8 +38,6 @@
 
 C.include "<nix/derivations.hh>"
 
-C.include "<nix/affinity.hh>"
-
 C.include "<nix/globals.hh>"
 
 C.include "hercules-ci-cnix/expr.hxx"
