diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,7 +6,11 @@
 project adheres to the [Haskell Package Versioning
 Policy (PVP)](https://pvp.haskell.org)
 
-## [1.4.0.0] - ?
+## [1.4.0.1] - 2026-08-29
+### Fixed
+  * More robust `clang` output parsing (allows building tests during Nix packaging) [accelerate-llvm#117]
+
+## [1.4.0.0] - 2026-04-02
 ### Changed
   * Support for LLVM-15 to 22 (15 only on native backend, 16 and newer are supported on native and PTX).
   * Simplified installation by using clang via the command line instead of linking with LLVM. Clang should be on the PATH or (on Windows) installed in a standard location.
@@ -76,4 +80,4 @@
 [1.0.0.0]:    https://github.com/AccelerateHS/accelerate-llvm/compare/be7f91295f77434b2103c70aa1cabb6a4f2b09a8...1.0.0.0
 
 [#407]:       https://github.com/AccelerateHS/accelerate/issues/407
-
+[accelerate-llvm#117]: https://github.com/AccelerateHS/accelerate-llvm/issues/117
diff --git a/accelerate-llvm.cabal b/accelerate-llvm.cabal
--- a/accelerate-llvm.cabal
+++ b/accelerate-llvm.cabal
@@ -1,7 +1,7 @@
 cabal-version:          2.2
 
 name:                   accelerate-llvm
-version:                1.4.0.0
+version:                1.4.0.1
 tested-with:            GHC >= 9.4
 build-type:             Simple
 
diff --git a/src/Data/Array/Accelerate/LLVM/Target/ClangInfo.hs b/src/Data/Array/Accelerate/LLVM/Target/ClangInfo.hs
--- a/src/Data/Array/Accelerate/LLVM/Target/ClangInfo.hs
+++ b/src/Data/Array/Accelerate/LLVM/Target/ClangInfo.hs
@@ -55,17 +55,28 @@
 -- | Returns list of version components: '12.3' becomes [12, 3].
 hostLLVMVersion :: NonEmpty Int
 hostLLVMVersion =
-  fmap read . splitOn '.' $
-    let firstLine = takeWhile (/= '\n') $
-                      dropWhile isSpace clangMachineVersionOutput
-    in case catMaybes (map (`startsWith` "clang version") (tails firstLine)) of
-         rest : _ ->
-           -- "Ubuntu clang version 14.0.0-1ubuntu1.1" <- we care about the "14.0.0" part only
-           takeWhile (\c -> not (isSpace c) && c /= '-')
-           $ dropWhile isSpace
-           $ rest
-         [] -> error $ "Could not extract clang version from `clang -###` output: <" ++ clangMachineVersionOutput ++ ">"
+  -- On Nix when building a package, the first 2 lines of stderr output are
+  --   "warning: Skipping impure flag -march=native because NIX_ENFORCE_NO_NATIVE is set"
+  -- and the same for -mcpu. Skip those and potential other such warnings by trying the first 5.
+  -- (Having NIX_ENFORCE_NO_NATIVE set obviously cripples performance, but since compiling the
+  -- test suite entails a kernel compilation (for runQ testing) it's good if this just works.
+  -- At runtime the warning goes to stderr and will be shown to the user if relevant.)
+  case catMaybes (map tryFromLine (take 5 (lines clangMachineVersionOutput))) of
+    res : _ -> res
+    [] -> error $ "Could not extract clang version from `clang -###` output: <" ++ clangMachineVersionOutput ++ ">"
   where
+  tryFromLine :: String -> Maybe (NonEmpty Int)
+  tryFromLine line =
+    case catMaybes (map (`startsWith` "clang version") (tails line)) of
+      rest : _ ->
+        Just $
+          fmap read . splitOn '.'
+          -- "Ubuntu clang version 14.0.0-1ubuntu1.1" <- we care about the "14.0.0" part only
+          $ takeWhile (\c -> not (isSpace c) && c /= '-')
+          $ dropWhile isSpace
+          $ rest
+      [] -> Nothing
+
   splitOn :: Eq a => a -> [a] -> NonEmpty [a]
   splitOn _ [] = [] NE.:| []
   splitOn sep (c:cs)
