summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2022-02-28 00:02:07 +0000
committerGitHub <noreply@github.com>2022-02-28 00:02:07 +0000
commit678711689037773117624ade4db4f977640cbb36 (patch)
tree4b900fe0c2d61be387687b901c36e8aa62739603 /pkgs/development
parent0a79f47878472cf5e12c1986a9a09829b0f32fee (diff)
parent0a8007498f9dba0d5feb191d16317ffa85a9e698 (diff)
downloadnixpkgs-678711689037773117624ade4db4f977640cbb36.tar
nixpkgs-678711689037773117624ade4db4f977640cbb36.tar.gz
nixpkgs-678711689037773117624ade4db4f977640cbb36.tar.bz2
nixpkgs-678711689037773117624ade4db4f977640cbb36.tar.lz
nixpkgs-678711689037773117624ade4db4f977640cbb36.tar.xz
nixpkgs-678711689037773117624ade4db4f977640cbb36.tar.zst
nixpkgs-678711689037773117624ade4db4f977640cbb36.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/fstar/default.nix14
-rw-r--r--pkgs/development/compilers/llvm/14/bintools/default.nix29
-rw-r--r--pkgs/development/compilers/llvm/14/clang/default.nix131
-rw-r--r--pkgs/development/compilers/llvm/14/clang/gnu-install-dirs.patch50
-rw-r--r--pkgs/development/compilers/llvm/14/clang/purity.patch28
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/X86-support-extension.patch21
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/armv7l.patch32
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/codesign.patch33
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/darwin-targetconditionals.patch71
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/default.nix126
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/gnu-install-dirs.patch42
-rw-r--r--pkgs/development/compilers/llvm/14/compiler-rt/normalize-var.patch16
-rw-r--r--pkgs/development/compilers/llvm/14/default.nix278
-rw-r--r--pkgs/development/compilers/llvm/14/libcxx/default.nix89
-rw-r--r--pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch85
-rw-r--r--pkgs/development/compilers/llvm/14/libcxxabi/default.nix86
-rw-r--r--pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch46
-rw-r--r--pkgs/development/compilers/llvm/14/libcxxabi/wasm.patch16
-rw-r--r--pkgs/development/compilers/llvm/14/libunwind/default.nix47
-rw-r--r--pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch65
-rw-r--r--pkgs/development/compilers/llvm/14/lld/default.nix55
-rw-r--r--pkgs/development/compilers/llvm/14/lld/fix-root-src-dir.patch13
-rw-r--r--pkgs/development/compilers/llvm/14/lld/gnu-install-dirs.patch22
-rw-r--r--pkgs/development/compilers/llvm/14/lldb/default.nix144
-rw-r--r--pkgs/development/compilers/llvm/14/lldb/gnu-install-dirs.patch36
-rw-r--r--pkgs/development/compilers/llvm/14/lldb/procfs.patch31
-rw-r--r--pkgs/development/compilers/llvm/14/lldb/resource-dir.patch13
-rw-r--r--pkgs/development/compilers/llvm/14/llvm/default.nix254
-rw-r--r--pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs-polly.patch102
-rw-r--r--pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs.patch220
-rw-r--r--pkgs/development/compilers/llvm/14/openmp/default.nix54
-rw-r--r--pkgs/development/compilers/llvm/14/openmp/fix-find-tool.patch54
-rw-r--r--pkgs/development/compilers/llvm/14/openmp/gnu-install-dirs.patch89
-rw-r--r--pkgs/development/compilers/llvm/git/lld/default.nix6
-rw-r--r--pkgs/development/compilers/purescript/purescript/default.nix6
-rw-r--r--pkgs/development/libraries/cmark-gfm/default.nix6
-rw-r--r--pkgs/development/libraries/libbap/default.nix4
-rw-r--r--pkgs/development/libraries/science/biology/htslib/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/apron/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/astring/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/atd/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/bap/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/batteries/default.nix8
-rw-r--r--pkgs/development/ocaml-modules/benchmark/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/bigarray-overlap/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/bigstringaf/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/biniou/1.0.nix5
-rw-r--r--pkgs/development/ocaml-modules/biniou/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/bitv/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/bolt/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/bos/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/bz2/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/calendar/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/camlimages/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/camlpdf/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/camlzip/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/camomile/0.8.2.nix4
-rw-r--r--pkgs/development/ocaml-modules/camomile/0.8.5.nix4
-rw-r--r--pkgs/development/ocaml-modules/camomile/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/caqti/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/carton/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/cfstream/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/checkseum/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/cil/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/cmdliner/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/coin/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/comparelib/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/config-file/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/cpdf/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/cryptgps/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/csv/1.5.nix4
-rw-r--r--pkgs/development/ocaml-modules/ctypes/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/digestif/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/dolmen/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/dolog/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/dum/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/dypgen/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/elina/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/eliom/default.nix10
-rw-r--r--pkgs/development/ocaml-modules/enumerate/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/erm_xml/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/erm_xmpp/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/expat/0.9.nix5
-rw-r--r--pkgs/development/ocaml-modules/expat/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/extlib/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/farfadet/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/fmt/default.nix8
-rw-r--r--pkgs/development/ocaml-modules/fontconfig/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/fpath/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/frontc/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/functory/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/getopt/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/gg/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/gmetadom/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/hacl-star/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/hacl-star/raw.nix4
-rw-r--r--pkgs/development/ocaml-modules/herelib/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/hidapi/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/hmap/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/hxd/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/inifiles/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/inotify/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/iso8601/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/janestreet/0.12.nix1
-rw-r--r--pkgs/development/ocaml-modules/janestreet/0.14.nix4
-rw-r--r--pkgs/development/ocaml-modules/janestreet/janePackage.nix6
-rw-r--r--pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix8
-rw-r--r--pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix4
-rw-r--r--pkgs/development/ocaml-modules/javalib/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/jsonm/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/lablgl/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/lablgtk-extras/1.4.nix2
-rw-r--r--pkgs/development/ocaml-modules/lablgtk-extras/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/lablgtk/2.14.0.nix4
-rw-r--r--pkgs/development/ocaml-modules/lablgtk/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/labltk/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/llvm/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/logs/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/lua-ml/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/lwt-exit/default.nix3
-rw-r--r--pkgs/development/ocaml-modules/lwt/default.nix9
-rw-r--r--pkgs/development/ocaml-modules/macaque/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/magick/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/merlin-extend/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/mirage-crypto/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/mirage-crypto/ec.nix13
-rw-r--r--pkgs/development/ocaml-modules/mirage-crypto/pk.nix4
-rw-r--r--pkgs/development/ocaml-modules/mirage-crypto/rng-async.nix4
-rw-r--r--pkgs/development/ocaml-modules/mirage-crypto/rng-mirage.nix4
-rw-r--r--pkgs/development/ocaml-modules/mirage-crypto/rng.nix6
-rw-r--r--pkgs/development/ocaml-modules/mlgmp/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/mlgmpidl/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/mtime/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/mysql/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/nocrypto/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/notty/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/num/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ocaml-cairo/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/ocaml-libvirt/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ocaml-r/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/ocamlfuse/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/ocamlnat/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/ocamlnet/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/ocamlsdl/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ocb-stubblr/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/ocp-ocamlres/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/ocplib-simplex/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/ocsigen-deriving/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/ocsigen-start/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ocurl/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/odate/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/odn/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/omd/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/opam-repository/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/otfm/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/otoml/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ounit/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/pipebang/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/piqi-ocaml/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/piqi/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ppx_cstubs/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/ppx_deriving/default.nix10
-rw-r--r--pkgs/development/ocaml-modules/ppx_tools/default.nix8
-rw-r--r--pkgs/development/ocaml-modules/psmt2-frontend/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ptime/default.nix7
-rw-r--r--pkgs/development/ocaml-modules/ptmap/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/pyml/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/react/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/reactivedata/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/reason-native/cli.nix5
-rw-r--r--pkgs/development/ocaml-modules/reason-native/console.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/dir.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/file-context-printer.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/fp.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/pastel-console.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/pastel.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/refmterr.nix2
-rw-r--r--pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix5
-rw-r--r--pkgs/development/ocaml-modules/reason-native/rely.nix2
-rw-r--r--pkgs/development/ocaml-modules/rope/default.nix9
-rw-r--r--pkgs/development/ocaml-modules/rresult/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/sawja/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/sedlex/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/sha/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/sodium/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/sosa/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/sqlite3EZ/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/stdcompat/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/tezos/legacy-store.nix4
-rw-r--r--pkgs/development/ocaml-modules/tezos/lmdb.nix4
-rw-r--r--pkgs/development/ocaml-modules/tezos/protocol-010-PtGRANAD.nix9
-rw-r--r--pkgs/development/ocaml-modules/tezos/protocol-011-PtHangz2.nix9
-rw-r--r--pkgs/development/ocaml-modules/tezos/store.nix4
-rw-r--r--pkgs/development/ocaml-modules/tezos/validation.nix4
-rw-r--r--pkgs/development/ocaml-modules/toml/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/topkg/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/tsdl/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/twt/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/type_conv/108.08.00.nix5
-rw-r--r--pkgs/development/ocaml-modules/type_conv/109.60.01.nix5
-rw-r--r--pkgs/development/ocaml-modules/type_conv/112.01.01.nix6
-rw-r--r--pkgs/development/ocaml-modules/uchar/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ulex/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/uucd/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/uucp/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/uuidm/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/uunf/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/uuseg/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/uutf/default.nix6
-rw-r--r--pkgs/development/ocaml-modules/uuuu/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/vg/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/webbrowser/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/xml-light/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/xmlm/default.nix5
-rw-r--r--pkgs/development/ocaml-modules/z3/default.nix4
-rw-r--r--pkgs/development/python-modules/APScheduler/default.nix4
-rw-r--r--pkgs/development/python-modules/aiogithubapi/default.nix4
-rw-r--r--pkgs/development/python-modules/celery/default.nix5
-rw-r--r--pkgs/development/python-modules/django-dynamic-preferences/default.nix4
-rw-r--r--pkgs/development/python-modules/fontparts/default.nix4
-rw-r--r--pkgs/development/python-modules/hg-evolve/default.nix4
-rw-r--r--pkgs/development/python-modules/ipython/default.nix8
-rw-r--r--pkgs/development/python-modules/pyamg/default.nix4
-rw-r--r--pkgs/development/python-modules/python-izone/default.nix4
-rw-r--r--pkgs/development/python-modules/readability-lxml/default.nix33
-rw-r--r--pkgs/development/python-modules/rpyc/default.nix4
-rw-r--r--pkgs/development/python-modules/weconnect-mqtt/default.nix6
-rw-r--r--pkgs/development/python-modules/weconnect/default.nix4
-rw-r--r--pkgs/development/tools/ocaml/camlidl/default.nix2
-rw-r--r--pkgs/development/tools/ocaml/merlin/4.x.nix14
-rw-r--r--pkgs/development/tools/ocaml/merlin/default.nix6
-rw-r--r--pkgs/development/tools/ocaml/oasis/default.nix6
-rw-r--r--pkgs/development/tools/ocaml/obelisk/default.nix7
-rw-r--r--pkgs/development/tools/ocaml/ocamlformat/generic.nix12
-rw-r--r--pkgs/development/tools/ocaml/ocp-index/default.nix5
-rw-r--r--pkgs/development/tools/ocaml/utop/default.nix3
-rw-r--r--pkgs/development/tools/omnisharp-roslyn/default.nix2
-rw-r--r--pkgs/development/tools/scalafmt/default.nix4
240 files changed, 3119 insertions, 296 deletions
diff --git a/pkgs/development/compilers/fstar/default.nix b/pkgs/development/compilers/fstar/default.nix
index 25abd794907..fc0f50d0797 100644
--- a/pkgs/development/compilers/fstar/default.nix
+++ b/pkgs/development/compilers/fstar/default.nix
@@ -11,20 +11,26 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-bK3McF/wTjT9q6luihPaEXjx7Lu6+ZbQ9G61Mc4KoB0=";
   };
 
-  nativeBuildInputs = [ makeWrapper installShellFiles ];
+  strictDeps = true;
 
-  buildInputs = [
-    z3
+  nativeBuildInputs = [
+    makeWrapper
+    installShellFiles
   ] ++ (with ocamlPackages; [
     ocaml
     findlib
     ocamlbuild
+    menhir
+  ]);
+
+  buildInputs = [
+    z3
+  ] ++ (with ocamlPackages; [
     batteries
     zarith
     stdint
     yojson
     fileutils
-    menhir
     menhirLib
     pprint
     sedlex_2
diff --git a/pkgs/development/compilers/llvm/14/bintools/default.nix b/pkgs/development/compilers/llvm/14/bintools/default.nix
new file mode 100644
index 00000000000..53f7941e336
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/bintools/default.nix
@@ -0,0 +1,29 @@
+{ runCommand, stdenv, llvm, lld, version }:
+
+let
+  prefix =
+    if stdenv.hostPlatform != stdenv.targetPlatform
+    then "${stdenv.targetPlatform.config}-"
+    else "";
+in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
+   mkdir -p $out/bin
+   for prog in ${lld}/bin/*; do
+     ln -s $prog $out/bin/${prefix}$(basename $prog)
+   done
+   for prog in ${llvm}/bin/*; do
+     ln -sf $prog $out/bin/${prefix}$(basename $prog)
+   done
+
+   ln -s ${llvm}/bin/llvm-ar $out/bin/${prefix}ar
+   ln -s ${llvm}/bin/llvm-as $out/bin/${prefix}as
+   ln -s ${llvm}/bin/llvm-dwp $out/bin/${prefix}dwp
+   ln -s ${llvm}/bin/llvm-nm $out/bin/${prefix}nm
+   ln -s ${llvm}/bin/llvm-objcopy $out/bin/${prefix}objcopy
+   ln -s ${llvm}/bin/llvm-objdump $out/bin/${prefix}objdump
+   ln -s ${llvm}/bin/llvm-ranlib $out/bin/${prefix}ranlib
+   ln -s ${llvm}/bin/llvm-readelf $out/bin/${prefix}readelf
+   ln -s ${llvm}/bin/llvm-size $out/bin/${prefix}size
+   ln -s ${llvm}/bin/llvm-strip $out/bin/${prefix}strip
+
+   ln -s ${lld}/bin/lld $out/bin/${prefix}ld
+''
diff --git a/pkgs/development/compilers/llvm/14/clang/default.nix b/pkgs/development/compilers/llvm/14/clang/default.nix
new file mode 100644
index 00000000000..9544494b356
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/clang/default.nix
@@ -0,0 +1,131 @@
+{ lib, stdenv, llvm_meta
+, monorepoSrc, runCommand
+, substituteAll, cmake, libxml2, libllvm, version, python3
+, buildLlvmTools
+, fixDarwinDylibNames
+, enableManpages ? false
+}:
+
+let
+  self = stdenv.mkDerivation (rec {
+    pname = "clang";
+    inherit version;
+
+    src = runCommand "${pname}-src-${version}" {} ''
+      mkdir -p "$out"
+      cp -r ${monorepoSrc}/cmake "$out"
+      cp -r ${monorepoSrc}/${pname} "$out"
+    '';
+
+    sourceRoot = "${src.name}/${pname}";
+
+    nativeBuildInputs = [ cmake python3 ]
+      ++ lib.optional enableManpages python3.pkgs.sphinx
+      ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
+
+    buildInputs = [ libxml2 libllvm ];
+
+    cmakeFlags = [
+      "-DCMAKE_CXX_FLAGS=-std=c++14"
+      "-DCLANGD_BUILD_XPC=OFF"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ lib.optionals enableManpages [
+      "-DCLANG_INCLUDE_DOCS=ON"
+      "-DLLVM_ENABLE_SPHINX=ON"
+      "-DSPHINX_OUTPUT_MAN=ON"
+      "-DSPHINX_OUTPUT_HTML=OFF"
+      "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+    ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+      "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+      "-DCLANG_TABLEGEN=${buildLlvmTools.libclang.dev}/bin/clang-tblgen"
+    ];
+
+    patches = [
+      ./purity.patch
+      # https://reviews.llvm.org/D51899
+      ./gnu-install-dirs.patch
+      (substituteAll {
+        src = ../../clang-11-12-LLVMgold-path.patch;
+        libllvmLibdir = "${libllvm.lib}/lib";
+      })
+    ];
+
+    postPatch = ''
+      (cd tools && ln -s ../../clang-tools-extra extra)
+
+      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
+             -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
+             lib/Driver/ToolChains/*.cpp
+
+      # Patch for standalone doc building
+      sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
+    '' + lib.optionalString stdenv.hostPlatform.isMusl ''
+      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
+    '';
+
+    outputs = [ "out" "lib" "dev" "python" ];
+
+    postInstall = ''
+      ln -sv $out/bin/clang $out/bin/cpp
+
+      # Move libclang to 'lib' output
+      moveToOutput "lib/libclang.*" "$lib"
+      moveToOutput "lib/libclang-cpp.*" "$lib"
+      substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
+          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang." \
+          --replace "\''${_IMPORT_PREFIX}/lib/libclang-cpp." "$lib/lib/libclang-cpp."
+
+      mkdir -p $python/bin $python/share/clang/
+      mv $out/bin/{git-clang-format,scan-view} $python/bin
+      if [ -e $out/bin/set-xcode-analyzer ]; then
+        mv $out/bin/set-xcode-analyzer $python/bin
+      fi
+      mv $out/share/clang/*.py $python/share/clang
+      rm $out/bin/c-index-test
+
+      mkdir -p $dev/bin
+      cp bin/clang-tblgen $dev/bin
+    '';
+
+    passthru = {
+      isClang = true;
+      inherit libllvm;
+    };
+
+    meta = llvm_meta // {
+      homepage = "https://clang.llvm.org/";
+      description = "A C language family frontend for LLVM";
+      longDescription = ''
+        The Clang project provides a language front-end and tooling
+        infrastructure for languages in the C language family (C, C++, Objective
+        C/C++, OpenCL, CUDA, and RenderScript) for the LLVM project.
+        It aims to deliver amazingly fast compiles, extremely useful error and
+        warning messages and to provide a platform for building great source
+        level tools. The Clang Static Analyzer and clang-tidy are tools that
+        automatically find bugs in your code, and are great examples of the sort
+        of tools that can be built using the Clang frontend as a library to
+        parse C/C++ code.
+      '';
+    };
+  } // lib.optionalAttrs enableManpages {
+    pname = "clang-manpages";
+
+    buildPhase = ''
+      make docs-clang-man
+    '';
+
+    installPhase = ''
+      mkdir -p $out/share/man/man1
+      # Manually install clang manpage
+      cp docs/man/*.1 $out/share/man/man1/
+    '';
+
+    outputs = [ "out" ];
+
+    doCheck = false;
+
+    meta = llvm_meta // {
+      description = "man page for Clang ${version}";
+    };
+  });
+in self
diff --git a/pkgs/development/compilers/llvm/14/clang/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/clang/gnu-install-dirs.patch
new file mode 100644
index 00000000000..57c54e18c37
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/clang/gnu-install-dirs.patch
@@ -0,0 +1,50 @@
+diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
+index 9bbbfc032b7d..947bd0da865d 100644
+--- a/cmake/modules/AddClang.cmake
++++ b/cmake/modules/AddClang.cmake
+@@ -119,8 +119,8 @@ macro(add_clang_library name)
+         install(TARGETS ${lib}
+           COMPONENT ${lib}
+           ${export_to_clangtargets}
+-          LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+-          ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
++          LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++          ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
+           RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+
+         if (NOT LLVM_ENABLE_IDE)
+@@ -175,7 +175,7 @@ endmacro()
+ macro(add_clang_symlink name dest)
+   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+   # Always generate install targets
+-  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
+
+ function(clang_target_link_libraries target type)
+diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt
+index 078988980c52..14b58614b40a 100644
+--- a/lib/Headers/CMakeLists.txt
++++ b/lib/Headers/CMakeLists.txt
+@@ -234,7 +234,7 @@ set_target_properties(clang-resource-headers PROPERTIES
+   FOLDER "Misc"
+   RUNTIME_OUTPUT_DIRECTORY "${output_dir}")
+
+-set(header_install_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
++set(header_install_dir ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include)
+
+ install(
+   FILES ${files} ${generated_files}
+diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
+index 4e0647971ab4..68dd67fcc476 100644
+--- a/tools/libclang/CMakeLists.txt
++++ b/tools/libclang/CMakeLists.txt
+@@ -216,7 +216,7 @@ foreach(PythonVersion ${CLANG_PYTHON_BINDINGS_VERSIONS})
+           COMPONENT
+             libclang-python-bindings
+           DESTINATION
+-            "lib${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
++            "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/python${PythonVersion}/site-packages")
+ endforeach()
+ if(NOT LLVM_ENABLE_IDE)
+   add_custom_target(libclang-python-bindings)
diff --git a/pkgs/development/compilers/llvm/14/clang/purity.patch b/pkgs/development/compilers/llvm/14/clang/purity.patch
new file mode 100644
index 00000000000..deb230a36c5
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/clang/purity.patch
@@ -0,0 +1,28 @@
+From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Thu, 18 May 2017 11:56:12 -0500
+Subject: [PATCH] "purity" patch for 5.0
+
+---
+ lib/Driver/ToolChains/Gnu.cpp | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
+index fe3c0191bb..c6a482bece 100644
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+   if (!IsStatic) {
+     if (Args.hasArg(options::OPT_rdynamic))
+       CmdArgs.push_back("-export-dynamic");
+-
+-    if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
+-      CmdArgs.push_back("-dynamic-linker");
+-      CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
+-                                           ToolChain.getDynamicLinker(Args)));
+-    }
+   }
+ 
+   CmdArgs.push_back("-o");
+-- 
+2.11.0
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/X86-support-extension.patch b/pkgs/development/compilers/llvm/14/compiler-rt/X86-support-extension.patch
new file mode 100644
index 00000000000..66742e5b149
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/X86-support-extension.patch
@@ -0,0 +1,21 @@
+diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt
+index 3a66dd9c3fb..7efc85d9f9f 100644
+--- a/lib/builtins/CMakeLists.txt
++++ b/lib/builtins/CMakeLists.txt
+@@ -345,4 +345,8 @@ if (NOT MSVC)
+ 
++  set(i486_SOURCES ${i386_SOURCES})
++  set(i586_SOURCES ${i386_SOURCES})
++  set(i686_SOURCES ${i386_SOURCES})
++
+   if (WIN32)
+     set(i386_SOURCES
+       ${i386_SOURCES}
+@@ -608,6 +612,7 @@ else ()
+   endif()
+ 
+   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
++      message("arch: ${arch}")
+     if (CAN_TARGET_${arch})
+       # For ARM archs, exclude any VFP builtins if VFP is not supported
+       if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/armv7l.patch b/pkgs/development/compilers/llvm/14/compiler-rt/armv7l.patch
new file mode 100644
index 00000000000..120cfe6feb2
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/armv7l.patch
@@ -0,0 +1,32 @@
+diff -ur compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake
+--- compiler-rt-10.0.0.src/cmake/builtin-config-ix.cmake	2020-03-24 00:01:02.000000000 +0900
++++ compiler-rt-10.0.0.src-patched/cmake/builtin-config-ix.cmake	2020-05-10 03:42:00.883450706 +0900
+@@ -24,7 +24,7 @@
+ 
+ 
+ set(ARM64 aarch64)
+-set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k)
++set(ARM32 arm armhf armv6m armv7m armv7em armv7 armv7s armv7k armv7l)
+ set(HEXAGON hexagon)
+ set(X86 i386)
+ set(X86_64 x86_64)
+diff -ur compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt
+--- compiler-rt-10.0.0.src/lib/builtins/CMakeLists.txt	2020-03-24 00:01:02.000000000 +0900
++++ compiler-rt-10.0.0.src-patched/lib/builtins/CMakeLists.txt	2020-05-10 03:44:49.468579650 +0900
+@@ -474,6 +474,7 @@
+ set(armv7_SOURCES ${arm_SOURCES})
+ set(armv7s_SOURCES ${arm_SOURCES})
+ set(armv7k_SOURCES ${arm_SOURCES})
++set(armv7l_SOURCES ${arm_SOURCES})
+ set(arm64_SOURCES ${aarch64_SOURCES})
+ 
+ # macho_embedded archs
+@@ -595,7 +596,7 @@
+   foreach (arch ${BUILTIN_SUPPORTED_ARCH})
+     if (CAN_TARGET_${arch})
+       # For ARM archs, exclude any VFP builtins if VFP is not supported
+-      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
++      if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7l|armv7m|armv7em)$")
+         string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
+         check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
+         if(NOT COMPILER_RT_HAS_${arch}_VFP)
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/codesign.patch b/pkgs/development/compilers/llvm/14/compiler-rt/codesign.patch
new file mode 100644
index 00000000000..065959d14d4
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/codesign.patch
@@ -0,0 +1,33 @@
+From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Tue, 19 Sep 2017 13:13:06 -0500
+Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that
+ needs it
+
+---
+ cmake/Modules/AddCompilerRT.cmake |  8 ------
+ test/asan/CMakeLists.txt          | 52 ---------------------------------------
+ test/tsan/CMakeLists.txt          | 47 -----------------------------------
+ 3 files changed, 107 deletions(-)
+
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index bc69ec95c419..9f100fdcec2f 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -366,14 +366,6 @@ function(add_compiler_rt_runtime name type)
+         set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
+         set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
+       endif()
+-      if(APPLE)
+-        # Ad-hoc sign the dylibs
+-        add_custom_command(TARGET ${libname}
+-          POST_BUILD  
+-          COMMAND codesign --sign - $<TARGET_FILE:${libname}>
+-          WORKING_DIRECTORY ${COMPILER_RT_OUTPUT_LIBRARY_DIR}
+-        )
+-      endif()
+     endif()
+ 
+     set(parent_target_arg)
+2.14.1
+
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/darwin-targetconditionals.patch b/pkgs/development/compilers/llvm/14/compiler-rt/darwin-targetconditionals.patch
new file mode 100644
index 00000000000..425dc2af01e
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/darwin-targetconditionals.patch
@@ -0,0 +1,71 @@
+diff --git a/lib/sanitizer_common/sanitizer_mac.cpp b/lib/sanitizer_common/sanitizer_mac.cpp
+--- a/lib/sanitizer_common/sanitizer_mac.cpp
++++ b/lib/sanitizer_common/sanitizer_mac.cpp
+@@ -613,9 +613,15 @@ HandleSignalMode GetHandleSignalMode(int signum) {
+ // Offset example:
+ // XNU 17 -- macOS 10.13 -- iOS 11 -- tvOS 11 -- watchOS 4
+ constexpr u16 GetOSMajorKernelOffset() {
+-  if (TARGET_OS_OSX) return 4;
+-  if (TARGET_OS_IOS || TARGET_OS_TV) return 6;
+-  if (TARGET_OS_WATCH) return 13;
++#if TARGET_OS_OSX
++  return 4;
++#endif
++#if TARGET_OS_IOS || TARGET_OS_TV
++  return 6;
++#endif
++#if TARGET_OS_WATCH
++  return 13;
++#endif
+ }
+ 
+ using VersStr = char[64];
+@@ -627,13 +633,13 @@ static uptr ApproximateOSVersionViaKernelVersion(VersStr vers) {
+   u16 os_major = kernel_major - offset;
+ 
+   const char *format = "%d.0";
+-  if (TARGET_OS_OSX) {
+-    if (os_major >= 16) {  // macOS 11+
+-      os_major -= 5;
+-    } else {  // macOS 10.15 and below
+-      format = "10.%d";
+-    }
++#if TARGET_OS_OSX
++  if (os_major >= 16) {  // macOS 11+
++    os_major -= 5;
++  } else {  // macOS 10.15 and below
++    format = "10.%d";
+   }
++#endif
+   return internal_snprintf(vers, sizeof(VersStr), format, os_major);
+ }
+ 
+@@ -681,15 +687,14 @@ void ParseVersion(const char *vers, u16 *major, u16 *minor) {
+ // Aligned versions example:
+ // macOS 10.15 -- iOS 13 -- tvOS 13 -- watchOS 6
+ static void MapToMacos(u16 *major, u16 *minor) {
+-  if (TARGET_OS_OSX)
+-    return;
+-
+-  if (TARGET_OS_IOS || TARGET_OS_TV)
++#if !TARGET_OS_OSX
++#if TARGET_OS_IOS || TARGET_OS_TV
+     *major += 2;
+-  else if (TARGET_OS_WATCH)
++#elif TARGET_OS_WATCH
+     *major += 9;
+-  else
++#else
+     UNREACHABLE("unsupported platform");
++#endif
+ 
+   if (*major >= 16) {  // macOS 11+
+     *major -= 5;
+@@ -697,6 +702,7 @@ static void MapToMacos(u16 *major, u16 *minor) {
+     *minor = *major;
+     *major = 10;
+   }
++#endif
+ }
+ 
+ static MacosVersion GetMacosAlignedVersionInternal() {
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/default.nix b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
new file mode 100644
index 00000000000..59ca5348fed
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/default.nix
@@ -0,0 +1,126 @@
+{ lib, stdenv, llvm_meta, version
+, monorepoSrc, runCommand
+, cmake, python3, libllvm, libcxxabi
+}:
+
+let
+
+  useLLVM = stdenv.hostPlatform.useLLVM or false;
+  bareMetal = stdenv.hostPlatform.parsed.kernel.name == "none";
+  haveLibc = stdenv.cc.libc != null;
+  inherit (stdenv.hostPlatform) isMusl;
+
+  baseName = "compiler-rt";
+
+  src = runCommand "${baseName}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${baseName} "$out"
+  '';
+in
+
+stdenv.mkDerivation {
+  pname = baseName + lib.optionalString (haveLibc) "-libc";
+  inherit version;
+
+  inherit src;
+  sourceRoot = "${src.name}/${baseName}";
+
+  nativeBuildInputs = [ cmake python3 libllvm.dev ];
+  buildInputs = lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
+
+  NIX_CFLAGS_COMPILE = [
+    "-DSCUDO_DEFAULT_OPTIONS=DeleteSizeMismatch=0:DeallocationTypeMismatch=0"
+  ];
+
+  cmakeFlags = [
+    "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
+    "-DCMAKE_C_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+    "-DCMAKE_ASM_COMPILER_TARGET=${stdenv.hostPlatform.config}"
+  ] ++ lib.optionals (useLLVM || bareMetal || isMusl) [
+    "-DCOMPILER_RT_BUILD_SANITIZERS=OFF"
+    "-DCOMPILER_RT_BUILD_XRAY=OFF"
+    "-DCOMPILER_RT_BUILD_LIBFUZZER=OFF"
+    "-DCOMPILER_RT_BUILD_PROFILE=OFF"
+    "-DCOMPILER_RT_BUILD_MEMPROF=OFF"
+    "-DCOMPILER_RT_BUILD_ORC=OFF" # may be possible to build with musl if necessary
+  ] ++ lib.optionals ((useLLVM || bareMetal) && !haveLibc) [
+    "-DCMAKE_C_COMPILER_WORKS=ON"
+    "-DCMAKE_CXX_COMPILER_WORKS=ON"
+    "-DCOMPILER_RT_BAREMETAL_BUILD=ON"
+    "-DCMAKE_SIZEOF_VOID_P=${toString (stdenv.hostPlatform.parsed.cpu.bits / 8)}"
+  ] ++ lib.optionals (useLLVM && !haveLibc) [
+    "-DCMAKE_C_FLAGS=-nodefaultlibs"
+  ] ++ lib.optionals (useLLVM) [
+    "-DCOMPILER_RT_BUILD_BUILTINS=ON"
+    #https://stackoverflow.com/questions/53633705/cmake-the-c-compiler-is-not-able-to-compile-a-simple-test-program
+    "-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY"
+  ] ++ lib.optionals (bareMetal) [
+    "-DCOMPILER_RT_OS_DIR=baremetal"
+  ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
+    "-DDARWIN_macosx_OVERRIDE_SDK_VERSION=ON"
+    "-DDARWIN_osx_ARCHS=${stdenv.hostPlatform.darwinArch}"
+    "-DDARWIN_osx_BUILTIN_ARCHS=${stdenv.hostPlatform.darwinArch}"
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  patches = [
+    ./codesign.patch # Revert compiler-rt commit that makes codesign mandatory
+    ./X86-support-extension.patch # Add support for i486 i586 i686 by reusing i386 config
+    ./gnu-install-dirs.patch
+    # ld-wrapper dislikes `-rpath-link //nix/store`, so we normalize away the
+    # extra `/`.
+    ./normalize-var.patch
+  ] # Prevent a compilation error on darwin
+    ++ lib.optional stdenv.hostPlatform.isDarwin ./darwin-targetconditionals.patch
+    ++ lib.optional stdenv.hostPlatform.isAarch32 ./armv7l.patch;
+
+  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
+  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
+  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
+  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
+  # a flag and turn the flag off during the stdenv build.
+  postPatch = lib.optionalString (!stdenv.isDarwin) ''
+    substituteInPlace cmake/builtin-config-ix.cmake \
+      --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
+  '' + lib.optionalString stdenv.isDarwin ''
+    substituteInPlace cmake/builtin-config-ix.cmake \
+      --replace 'set(ARM64 arm64 arm64e)' 'set(ARM64)'
+    substituteInPlace cmake/config-ix.cmake \
+      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
+  '' + lib.optionalString (useLLVM) ''
+    substituteInPlace lib/builtins/int_util.c \
+      --replace "#include <stdlib.h>" ""
+    substituteInPlace lib/builtins/clear_cache.c \
+      --replace "#include <assert.h>" ""
+    substituteInPlace lib/builtins/cpu_model.c \
+      --replace "#include <assert.h>" ""
+  '';
+
+  # Hack around weird upsream RPATH bug
+  postInstall = lib.optionalString (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isWasm) ''
+    ln -s "$out/lib"/*/* "$out/lib"
+  '' + lib.optionalString (useLLVM) ''
+    ln -s $out/lib/*/clang_rt.crtbegin-*.o $out/lib/crtbegin.o
+    ln -s $out/lib/*/clang_rt.crtend-*.o $out/lib/crtend.o
+    ln -s $out/lib/*/clang_rt.crtbegin_shared-*.o $out/lib/crtbeginS.o
+    ln -s $out/lib/*/clang_rt.crtend_shared-*.o $out/lib/crtendS.o
+  '';
+
+  meta = llvm_meta // {
+    homepage = "https://compiler-rt.llvm.org/";
+    description = "Compiler runtime libraries";
+    longDescription = ''
+      The compiler-rt project provides highly tuned implementations of the
+      low-level code generator support routines like "__fixunsdfdi" and other
+      calls generated when a target doesn't have a short sequence of native
+      instructions to implement a core IR operation. It also provides
+      implementations of run-time libraries for dynamic testing tools such as
+      AddressSanitizer, ThreadSanitizer, MemorySanitizer, and DataFlowSanitizer.
+    '';
+    # "All of the code in the compiler-rt project is dual licensed under the MIT
+    # license and the UIUC License (a BSD-like license)":
+    license = with lib.licenses; [ mit ncsa ];
+  };
+}
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/compiler-rt/gnu-install-dirs.patch
new file mode 100644
index 00000000000..55837bd8e45
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/gnu-install-dirs.patch
@@ -0,0 +1,42 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3a41aa43e406..f000cee6eae0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -5,6 +5,8 @@
+
+ cmake_minimum_required(VERSION 3.13.4)
+
++include(GNUInstallDirs)
++
+ # Check if compiler-rt is built as a standalone project.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR OR COMPILER_RT_STANDALONE_BUILD)
+   project(CompilerRT C CXX ASM)
+diff --git a/cmake/base-config-ix.cmake b/cmake/base-config-ix.cmake
+index d7b0124f3546..3e111146df4d 100644
+--- a/cmake/base-config-ix.cmake
++++ b/cmake/base-config-ix.cmake
+@@ -67,7 +67,7 @@ if (LLVM_TREE_AVAILABLE)
+ else()
+     # Take output dir and install path from the user.
+   set(COMPILER_RT_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH
+-    "Path where built compiler-rt libraries should be stored.")
++    "Path where built compiler-rt build artifacts should be stored.")
+   set(COMPILER_RT_EXEC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/bin CACHE PATH
+     "Path where built compiler-rt executables should be stored.")
+   set(COMPILER_RT_INSTALL_PATH "" CACHE PATH
+@@ -99,13 +99,13 @@ endif()
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+   set(COMPILER_RT_OUTPUT_LIBRARY_DIR
+     ${COMPILER_RT_OUTPUT_DIR}/lib)
+-  extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" lib)
++  extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}")
+   set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
+     "Path where built compiler-rt libraries should be installed.")
+ else(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+   set(COMPILER_RT_OUTPUT_LIBRARY_DIR
+     ${COMPILER_RT_OUTPUT_DIR}/lib/${COMPILER_RT_OS_DIR})
+-  extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "lib/${COMPILER_RT_OS_DIR}")
++  extend_path(default_install_path "${COMPILER_RT_INSTALL_PATH}" "${CMAKE_INSTALL_LIBDIR}/${COMPILER_RT_OS_DIR}")
+   set(COMPILER_RT_INSTALL_LIBRARY_DIR "${default_install_path}" CACHE PATH
+     "Path where built compiler-rt libraries should be installed.")
+ endif()
diff --git a/pkgs/development/compilers/llvm/14/compiler-rt/normalize-var.patch b/pkgs/development/compilers/llvm/14/compiler-rt/normalize-var.patch
new file mode 100644
index 00000000000..135cf625ef7
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/compiler-rt/normalize-var.patch
@@ -0,0 +1,16 @@
+diff --git a/compiler-rt/cmake/Modules/CompilerRTUtils.cmake b/compiler-rt/cmake/Modules/CompilerRTUtils.cmake
+index f1f46fb9599c..6f19e69507ba 100644
+--- a/cmake/Modules/CompilerRTUtils.cmake
++++ b/cmake/Modules/CompilerRTUtils.cmake
+@@ -302,8 +302,9 @@ macro(load_llvm_config)
+     # Get some LLVM variables from LLVMConfig.
+     include("${LLVM_CMAKE_PATH}/LLVMConfig.cmake")
+ 
+-    set(LLVM_LIBRARY_OUTPUT_INTDIR
+-      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
++    get_filename_component(LLVM_LIBRARY_OUTPUT_INTDIR
++      ${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX}
++      REALPATH)
+   endif()
+ endmacro()
+ 
diff --git a/pkgs/development/compilers/llvm/14/default.nix b/pkgs/development/compilers/llvm/14/default.nix
new file mode 100644
index 00000000000..6f4a0d8ee75
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/default.nix
@@ -0,0 +1,278 @@
+{ lowPrio, newScope, pkgs, lib, stdenv, cmake
+, gccForLibs, preLibcCrossHeaders
+, libxml2, python3, isl, fetchFromGitHub, overrideCC, wrapCCWith, wrapBintoolsWith
+, buildLlvmTools # tools, but from the previous stage, for cross
+, targetLlvmLibraries # libraries, but from the next stage, for cross
+# This is the default binutils, but with *this* version of LLD rather
+# than the default LLVM verion's, if LLD is the choice. We use these for
+# the `useLLVM` bootstrapping below.
+, bootBintoolsNoLibc ?
+    if stdenv.targetPlatform.linker == "lld"
+    then null
+    else pkgs.bintoolsNoLibc
+, bootBintools ?
+    if stdenv.targetPlatform.linker == "lld"
+    then null
+    else pkgs.bintools
+, darwin
+}:
+
+let
+  release_version = "14.0.0";
+  candidate = "rc1"; # empty or "rcN"
+  dash-candidate = lib.optionalString (candidate != "") "-${candidate}";
+  rev = ""; # When using a Git commit
+  rev-version = ""; # When using a Git commit
+  version = if rev != "" then rev-version else "${release_version}${dash-candidate}";
+  targetConfig = stdenv.targetPlatform.config;
+
+  monorepoSrc = fetchFromGitHub {
+    owner = "llvm";
+    repo = "llvm-project";
+    rev = if rev != "" then rev else "llvmorg-${version}";
+    sha256 = "sha256-bO13J5bhE4YVGvoaTuzFgf62HYh+Shv6T0u07CFjI9E=";
+  };
+
+  llvm_meta = {
+    license     = lib.licenses.ncsa;
+    maintainers = with lib.maintainers; [ lovek323 raskin dtzWill primeos ];
+    platforms   = lib.platforms.all;
+  };
+
+  tools = lib.makeExtensible (tools: let
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python3 isl release_version version monorepoSrc buildLlvmTools; });
+    mkExtraBuildCommands0 = cc: ''
+      rsrc="$out/resource-root"
+      mkdir "$rsrc"
+      ln -s "${cc.lib}/lib/clang/${release_version}/include" "$rsrc"
+      echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
+    '';
+    mkExtraBuildCommands = cc: mkExtraBuildCommands0 cc + ''
+      ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+      ln -s "${targetLlvmLibraries.compiler-rt.out}/share" "$rsrc/share"
+    '';
+
+  bintoolsNoLibc' =
+    if bootBintoolsNoLibc == null
+    then tools.bintoolsNoLibc
+    else bootBintoolsNoLibc;
+  bintools' =
+    if bootBintools == null
+    then tools.bintools
+    else bootBintools;
+
+  in {
+
+    libllvm = callPackage ./llvm {
+      inherit llvm_meta;
+    };
+
+    # `llvm` historically had the binaries.  When choosing an output explicitly,
+    # we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
+    llvm = tools.libllvm.out // { outputSpecified = false; };
+
+    libclang = callPackage ./clang {
+      inherit llvm_meta;
+    };
+
+    clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
+
+    llvm-manpages = lowPrio (tools.libllvm.override {
+      enableManpages = true;
+      python3 = pkgs.python3;  # don't use python-boot
+    });
+
+    clang-manpages = lowPrio (tools.libclang.override {
+      enableManpages = true;
+      python3 = pkgs.python3;  # don't use python-boot
+    });
+
+    # TODO: lldb/docs/index.rst:155:toctree contains reference to nonexisting document 'design/structureddataplugins'
+    # lldb-manpages = lowPrio (tools.lldb.override {
+    #   enableManpages = true;
+    #   python3 = pkgs.python3;  # don't use python-boot
+    # });
+
+    # pick clang appropriate for package set we are targeting
+    clang =
+      /**/ if stdenv.targetPlatform.useLLVM or false then tools.clangUseLLVM
+      else if (pkgs.targetPackages.stdenv or stdenv).cc.isGNU then tools.libstdcxxClang
+      else tools.libcxxClang;
+
+    libstdcxxClang = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      # libstdcxx is taken from gcc in an ad-hoc way in cc-wrapper.
+      libcxx = null;
+      extraPackages = [
+        targetLlvmLibraries.compiler-rt
+      ];
+      extraBuildCommands = mkExtraBuildCommands cc;
+    };
+
+    libcxxClang = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      libcxx = targetLlvmLibraries.libcxx;
+      extraPackages = [
+        targetLlvmLibraries.libcxxabi
+        targetLlvmLibraries.compiler-rt
+      ];
+      extraBuildCommands = mkExtraBuildCommands cc;
+    };
+
+    lld = callPackage ./lld {
+      inherit llvm_meta;
+    };
+
+    lldb = callPackage ./lldb {
+      inherit llvm_meta;
+      inherit (darwin) libobjc bootstrap_cmds;
+      inherit (darwin.apple_sdk.libs) xpc;
+      inherit (darwin.apple_sdk.frameworks) Foundation Carbon Cocoa;
+    };
+
+    # Below, is the LLVM bootstrapping logic. It handles building a
+    # fully LLVM toolchain from scratch. No GCC toolchain should be
+    # pulled in. As a consequence, it is very quick to build different
+    # targets provided by LLVM and we can also build for what GCC
+    # doesn’t support like LLVM. Probably we should move to some other
+    # file.
+
+    bintools-unwrapped = callPackage ./bintools {};
+
+    bintoolsNoLibc = wrapBintoolsWith {
+      bintools = tools.bintools-unwrapped;
+      libc = preLibcCrossHeaders;
+    };
+
+    bintools = wrapBintoolsWith {
+      bintools = tools.bintools-unwrapped;
+    };
+
+    clangUseLLVM = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      libcxx = targetLlvmLibraries.libcxx;
+      bintools = bintools';
+      extraPackages = [
+        targetLlvmLibraries.libcxxabi
+        targetLlvmLibraries.compiler-rt
+      ] ++ lib.optionals (!stdenv.targetPlatform.isWasm) [
+        targetLlvmLibraries.libunwind
+      ];
+      extraBuildCommands = ''
+        echo "-rtlib=compiler-rt -Wno-unused-command-line-argument" >> $out/nix-support/cc-cflags
+        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
+      '' + lib.optionalString (!stdenv.targetPlatform.isWasm) ''
+        echo "--unwindlib=libunwind" >> $out/nix-support/cc-cflags
+      '' + lib.optionalString (!stdenv.targetPlatform.isWasm && stdenv.targetPlatform.useLLVM or false) ''
+        echo "-lunwind" >> $out/nix-support/cc-ldflags
+      '' + lib.optionalString stdenv.targetPlatform.isWasm ''
+        echo "-fno-exceptions" >> $out/nix-support/cc-cflags
+      '' + mkExtraBuildCommands cc;
+    };
+
+    clangNoLibcxx = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      libcxx = null;
+      bintools = bintools';
+      extraPackages = [
+        targetLlvmLibraries.compiler-rt
+      ];
+      extraBuildCommands = ''
+        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
+        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
+        echo "-nostdlib++" >> $out/nix-support/cc-cflags
+      '' + mkExtraBuildCommands cc;
+    };
+
+    clangNoLibc = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      libcxx = null;
+      bintools = bintoolsNoLibc';
+      extraPackages = [
+        targetLlvmLibraries.compiler-rt
+      ];
+      extraBuildCommands = ''
+        echo "-rtlib=compiler-rt" >> $out/nix-support/cc-cflags
+        echo "-B${targetLlvmLibraries.compiler-rt}/lib" >> $out/nix-support/cc-cflags
+      '' + mkExtraBuildCommands cc;
+    };
+
+    clangNoCompilerRt = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      libcxx = null;
+      bintools = bintoolsNoLibc';
+      extraPackages = [ ];
+      extraBuildCommands = ''
+        echo "-nostartfiles" >> $out/nix-support/cc-cflags
+      '' + mkExtraBuildCommands0 cc;
+    };
+
+    clangNoCompilerRtWithLibc = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      libcxx = null;
+      bintools = bintools';
+      extraPackages = [ ];
+      extraBuildCommands = mkExtraBuildCommands0 cc;
+    };
+
+  });
+
+  libraries = lib.makeExtensible (libraries: let
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python3 isl release_version version monorepoSrc; });
+  in {
+
+    compiler-rt-libc = callPackage ./compiler-rt {
+      inherit llvm_meta;
+      stdenv = if stdenv.hostPlatform.useLLVM or false
+               then overrideCC stdenv buildLlvmTools.clangNoCompilerRtWithLibc
+               else stdenv;
+    };
+
+    compiler-rt-no-libc = callPackage ./compiler-rt {
+      inherit llvm_meta;
+      stdenv = if stdenv.hostPlatform.useLLVM or false
+               then overrideCC stdenv buildLlvmTools.clangNoCompilerRt
+               else stdenv;
+    };
+
+    # N.B. condition is safe because without useLLVM both are the same.
+    compiler-rt = if stdenv.hostPlatform.isAndroid
+      then libraries.compiler-rt-libc
+      else libraries.compiler-rt-no-libc;
+
+    stdenv = overrideCC stdenv buildLlvmTools.clang;
+
+    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
+
+    libcxx = callPackage ./libcxx {
+      inherit llvm_meta;
+      stdenv = if stdenv.hostPlatform.useLLVM or false
+               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
+               else stdenv;
+    };
+
+    libcxxabi = let
+      stdenv_ = if stdenv.hostPlatform.useLLVM or false
+               then overrideCC stdenv buildLlvmTools.clangNoLibcxx
+               else stdenv;
+      cxx-headers = callPackage ./libcxx {
+        inherit llvm_meta;
+        stdenv = stdenv_;
+        headersOnly = true;
+      };
+    in callPackage ./libcxxabi {
+      stdenv = stdenv_;
+      inherit llvm_meta cxx-headers;
+    };
+
+    libunwind = callPackage ./libunwind {
+      inherit llvm_meta;
+      stdenv = overrideCC stdenv buildLlvmTools.clangNoLibcxx;
+    };
+
+    openmp = callPackage ./openmp {
+      inherit llvm_meta;
+    };
+  });
+
+in { inherit tools libraries release_version; } // libraries // tools
diff --git a/pkgs/development/compilers/llvm/14/libcxx/default.nix b/pkgs/development/compilers/llvm/14/libcxx/default.nix
new file mode 100644
index 00000000000..8891a69937a
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libcxx/default.nix
@@ -0,0 +1,89 @@
+{ lib, stdenv, llvm_meta
+, monorepoSrc, runCommand
+, cmake, python3, fixDarwinDylibNames, version
+, libcxxabi
+, enableShared ? !stdenv.hostPlatform.isStatic
+
+# If headersOnly is true, the resulting package would only include the headers.
+# Use this to break the circular dependency between libcxx and libcxxabi.
+#
+# Some context:
+# https://reviews.llvm.org/rG1687f2bbe2e2aaa092f942d4a97d41fad43eedfb
+, headersOnly ? false
+}:
+
+let
+  basename = "libcxx";
+in
+
+stdenv.mkDerivation rec {
+  pname = basename + lib.optionalString headersOnly "-headers";
+  inherit version;
+
+  src = runCommand "${pname}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${basename} "$out"
+    mkdir -p "$out/libcxxabi"
+    cp -r ${monorepoSrc}/libcxxabi/include "$out/libcxxabi"
+    mkdir -p "$out/llvm"
+    cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
+    cp -r ${monorepoSrc}/llvm/utils "$out/llvm"
+  '';
+
+  sourceRoot = "${src.name}/${basename}";
+
+  outputs = [ "out" ] ++ lib.optional (!headersOnly) "dev";
+
+  patches = [
+    ./gnu-install-dirs.patch
+  ] ++ lib.optionals stdenv.hostPlatform.isMusl [
+    ../../libcxx-0001-musl-hacks.patch
+  ];
+
+  preConfigure = lib.optionalString stdenv.hostPlatform.isMusl ''
+    patchShebangs utils/cat_files.py
+  '';
+
+  nativeBuildInputs = [ cmake python3 ]
+    ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  buildInputs = lib.optionals (!headersOnly) [ libcxxabi ];
+
+  cmakeFlags = [ "-DLIBCXX_CXX_ABI=libcxxabi" ]
+    ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
+    ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
+      "-DLIBCXX_ENABLE_THREADS=OFF"
+      "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
+      "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
+    ] ++ lib.optional (!enableShared) "-DLIBCXX_ENABLE_SHARED=OFF";
+
+  buildFlags = lib.optional headersOnly "generate-cxx-headers";
+  installTargets = lib.optional headersOnly "install-cxx-headers";
+
+  # At this point, cxxabi headers would be installed in the dev output, which
+  # prevents moveToOutput from doing its job later in the build process.
+  postInstall = lib.optionalString (!headersOnly) ''
+    mv "$dev/include/c++/v1/"* "$out/include/c++/v1/"
+    pushd "$dev"
+    rmdir -p include/c++/v1
+    popd
+  '';
+
+  passthru = {
+    isLLVM = true;
+  };
+
+  meta = llvm_meta // {
+    homepage = "https://libcxx.llvm.org/";
+    description = "C++ standard library";
+    longDescription = ''
+      libc++ is an implementation of the C++ standard library, targeting C++11,
+      C++14 and above.
+    '';
+    # "All of the code in libc++ is dual licensed under the MIT license and the
+    # UIUC License (a BSD-like license)":
+    license = with lib.licenses; [ mit ncsa ];
+  };
+}
diff --git a/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch
new file mode 100644
index 00000000000..0f1d5c411ab
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libcxx/gnu-install-dirs.patch
@@ -0,0 +1,85 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b0569a4a54ca..7d665f5a3258 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -10,6 +10,8 @@ endif()
+ #===============================================================================
+ cmake_minimum_required(VERSION 3.13.4)
+ 
++include(GNUInstallDirs)
++
+ set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
+ 
+ # Add path for custom modules
+@@ -415,13 +417,13 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+   set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LLVM_BINARY_DIR}/include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1")
+-  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
++  set(LIBCXX_INSTALL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH
+       "Path where built libc++ libraries should be installed.")
+-  set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libc++ runtime libraries should be installed.")
+-  set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
++  set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
+       "Path where target-agnostic libc++ headers should be installed.")
+-  set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "include/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
++  set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}/c++/v1" CACHE PATH
+       "Path where target-specific libc++ headers should be installed.")
+   if(LIBCXX_LIBDIR_SUBDIR)
+     string(APPEND LIBCXX_LIBRARY_DIR /${LIBCXX_LIBDIR_SUBDIR})
+@@ -431,11 +433,11 @@ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+   set(LIBCXX_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+   set(LIBCXX_GENERATED_INCLUDE_DIR "${LLVM_BINARY_DIR}/include/c++/v1")
+   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
+-  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
++  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
+       "Path where built libc++ libraries should be installed.")
+-  set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}/c++/v1" CACHE PATH
+       "Path where built libc++ runtime libraries should be installed.")
+-  set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
++  set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
+       "Path where target-agnostic libc++ headers should be installed.")
+   set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
+       "Path where target-specific libc++ headers should be installed.")
+@@ -443,11 +445,11 @@ else()
+   set(LIBCXX_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXX_LIBDIR_SUFFIX})
+   set(LIBCXX_GENERATED_INCLUDE_DIR "${CMAKE_BINARY_DIR}/include/c++/v1")
+   set(LIBCXX_GENERATED_INCLUDE_TARGET_DIR "${LIBCXX_GENERATED_INCLUDE_DIR}")
+-  set(LIBCXX_INSTALL_LIBRARY_DIR lib${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
++  set(LIBCXX_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXX_LIBDIR_SUFFIX} CACHE PATH
+       "Path where built libc++ libraries should be installed.")
+-  set(LIBCXX_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBCXX_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libc++ runtime libraries should be installed.")
+-  set(LIBCXX_INSTALL_INCLUDE_DIR "include/c++/v1" CACHE PATH
++  set(LIBCXX_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1" CACHE PATH
+       "Path where target-agnostic libc++ headers should be installed.")
+   set(LIBCXX_INSTALL_INCLUDE_TARGET_DIR "${LIBCXX_INSTALL_INCLUDE_DIR}" CACHE PATH
+       "Path where target-specific libc++ headers should be installed.")
+diff --git a/cmake/Modules/HandleLibCXXABI.cmake b/cmake/Modules/HandleLibCXXABI.cmake
+index 5a8a4a270a1a..d69405ddeeac 100644
+--- a/cmake/Modules/HandleLibCXXABI.cmake
++++ b/cmake/Modules/HandleLibCXXABI.cmake
+@@ -1,8 +1,9 @@
+-
+ #===============================================================================
+ # Add an ABI library if appropriate
+ #===============================================================================
+ 
++include(GNUInstallDirs)
++
+ #
+ # _setup_abi: Set up the build to use an ABI library
+ #
+@@ -63,7 +64,7 @@ macro(setup_abi_lib abidefines abishared abistatic abifiles abidirs)
+ 
+         if (LIBCXX_INSTALL_HEADERS)
+           install(FILES "${LIBCXX_BINARY_INCLUDE_DIR}/${fpath}"
+-            DESTINATION include/c++/v1/${dstdir}
++            DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/c++/v1/${dstdir}"
+             COMPONENT cxx-headers
+             PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+             )
diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/default.nix b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
new file mode 100644
index 00000000000..d64708ab040
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libcxxabi/default.nix
@@ -0,0 +1,86 @@
+{ lib, stdenv, llvm_meta, cmake, python3
+, monorepoSrc, runCommand
+, cxx-headers, libunwind, version
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libcxxabi";
+  inherit version;
+
+  src = runCommand "${pname}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${pname} "$out"
+    mkdir -p "$out/libcxx/src"
+    cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
+    cp -r ${monorepoSrc}/libcxx/include "$out/libcxx"
+    cp -r ${monorepoSrc}/libcxx/src/include "$out/libcxx/src"
+    mkdir -p "$out/llvm"
+    cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
+  '';
+
+  sourceRoot = "${src.name}/${pname}";
+
+  outputs = [ "out" "dev" ];
+
+  postUnpack = lib.optionalString stdenv.isDarwin ''
+    export TRIPLE=x86_64-apple-darwin
+  '' + lib.optionalString stdenv.hostPlatform.isWasm ''
+    patch -p1 -d llvm -i ${./wasm.patch}
+  '';
+
+  patches = [
+    ./gnu-install-dirs.patch
+  ];
+
+  nativeBuildInputs = [ cmake python3 ];
+  buildInputs = lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD && !stdenv.hostPlatform.isWasm) libunwind;
+
+  cmakeFlags = [
+    "-DLIBCXXABI_LIBCXX_INCLUDES=${cxx-headers}/include/c++/v1"
+  ] ++ lib.optionals (stdenv.hostPlatform.useLLVM or false) [
+    "-DLLVM_ENABLE_LIBCXX=ON"
+    "-DLIBCXXABI_USE_LLVM_UNWINDER=ON"
+  ] ++ lib.optionals stdenv.hostPlatform.isWasm [
+    "-DLIBCXXABI_ENABLE_THREADS=OFF"
+    "-DLIBCXXABI_ENABLE_EXCEPTIONS=OFF"
+  ] ++ lib.optionals (!enableShared) [
+    "-DLIBCXXABI_ENABLE_SHARED=OFF"
+  ];
+
+  installPhase = if stdenv.isDarwin
+    then ''
+      for file in lib/*.dylib; do
+        # this should be done in CMake, but having trouble figuring out
+        # the magic combination of necessary CMake variables
+        # if you fancy a try, take a look at
+        # https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/RPATH-handling
+        install_name_tool -id $out/$file $file
+      done
+      make install
+      install -d 755 $out/include
+      install -m 644 ../include/*.h $out/include
+    ''
+    else ''
+      install -d -m 755 $out/include $out/lib
+      install -m 644 lib/libc++abi.a $out/lib
+      install -m 644 ../include/cxxabi.h $out/include
+    '' + lib.optionalString enableShared ''
+      install -m 644 lib/libc++abi.so.1.0 $out/lib
+      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
+      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
+    '';
+
+  meta = llvm_meta // {
+    homepage = "https://libcxxabi.llvm.org/";
+    description = "Provides C++ standard library support";
+    longDescription = ''
+      libc++abi is a new implementation of low level support for a standard C++ library.
+    '';
+    # "All of the code in libc++abi is dual licensed under the MIT license and
+    # the UIUC License (a BSD-like license)":
+    license = with lib.licenses; [ mit ncsa ];
+    maintainers = llvm_meta.maintainers ++ [ lib.maintainers.vlstill ];
+  };
+}
diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch
new file mode 100644
index 00000000000..a93348ded0c
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libcxxabi/gnu-install-dirs.patch
@@ -0,0 +1,46 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 858f5d5cfd7f..16c67d7062be 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -10,6 +10,8 @@ endif()
+ 
+ cmake_minimum_required(VERSION 3.13.4)
+ 
++include(GNUInstallDirs)
++
+ set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
+ 
+ # Add path for custom modules
+@@ -213,9 +215,9 @@ set(CMAKE_MODULE_PATH
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+   set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
+   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+-  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
++  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
+       "Path where built libc++abi libraries should be installed.")
+-  set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libc++abi runtime libraries should be installed.")
+   if(LIBCXX_LIBDIR_SUBDIR)
+     string(APPEND LIBCXXABI_LIBRARY_DIR /${LIBCXXABI_LIBDIR_SUBDIR})
+@@ -224,16 +226,16 @@ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+ elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+   set(LIBCXXABI_HEADER_DIR ${LLVM_BINARY_DIR})
+   set(LIBCXXABI_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+-  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
++  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
+       "Path where built libc++abi libraries should be installed.")
+-  set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libc++abi runtime libraries should be installed.")
+ else()
+   set(LIBCXXABI_HEADER_DIR ${CMAKE_BINARY_DIR})
+   set(LIBCXXABI_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBCXXABI_LIBDIR_SUFFIX})
+-  set(LIBCXXABI_INSTALL_LIBRARY_DIR lib${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
++  set(LIBCXXABI_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBCXXABI_LIBDIR_SUFFIX} CACHE PATH
+       "Path where built libc++abi libraries should be installed.")
+-  set(LIBCXXABI_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBCXXABI_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libc++abi runtime libraries should be installed.")
+ endif()
+ 
diff --git a/pkgs/development/compilers/llvm/14/libcxxabi/wasm.patch b/pkgs/development/compilers/llvm/14/libcxxabi/wasm.patch
new file mode 100644
index 00000000000..4ebfe46aa81
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libcxxabi/wasm.patch
@@ -0,0 +1,16 @@
+diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake
+index 15497d405e0..33f7f18193a 100644
+--- a/cmake/modules/HandleLLVMOptions.cmake
++++ b/cmake/modules/HandleLLVMOptions.cmake
+@@ -127,7 +127,10 @@ else(WIN32)
+       set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
+     endif()
+   else(FUCHSIA OR UNIX)
+-    MESSAGE(SEND_ERROR "Unable to determine platform")
++    if(${CMAKE_SYSTEM_NAME} MATCHES "Wasi")
++    else()
++      MESSAGE(SEND_ERROR "Unable to determine platform")
++    endif()
+   endif(FUCHSIA OR UNIX)
+ endif(WIN32)
+ 
diff --git a/pkgs/development/compilers/llvm/14/libunwind/default.nix b/pkgs/development/compilers/llvm/14/libunwind/default.nix
new file mode 100644
index 00000000000..c6d9eda5e47
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libunwind/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, llvm_meta, version
+, monorepoSrc, runCommand
+, cmake
+, enableShared ? !stdenv.hostPlatform.isStatic
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libunwind";
+  inherit version;
+
+  # I am not so comfortable giving libc++ and friends the whole monorepo as
+  # requested, so I filter it to what is needed.
+  src = runCommand "${pname}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${pname} "$out"
+    mkdir -p "$out/libcxx"
+    cp -r ${monorepoSrc}/libcxx/cmake "$out/libcxx"
+    cp -r ${monorepoSrc}/libcxx/utils "$out/libcxx"
+    mkdir -p "$out/llvm"
+    cp -r ${monorepoSrc}/llvm/cmake "$out/llvm"
+  '';
+
+  sourceRoot = "${src.name}/${pname}";
+
+  patches = [
+    ./gnu-install-dirs.patch
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake ];
+
+  cmakeFlags = lib.optional (!enableShared) "-DLIBUNWIND_ENABLE_SHARED=OFF";
+
+  meta = llvm_meta // {
+    # Details: https://github.com/llvm/llvm-project/blob/main/libunwind/docs/index.rst
+    homepage = "https://clang.llvm.org/docs/Toolchain.html#unwind-library";
+    description = "LLVM's unwinder library";
+    longDescription = ''
+      The unwind library provides a family of _Unwind_* functions implementing
+      the language-neutral stack unwinding portion of the Itanium C++ ABI (Level
+      I). It is a dependency of the C++ ABI library, and sometimes is a
+      dependency of other runtimes.
+    '';
+  };
+}
diff --git a/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch
new file mode 100644
index 00000000000..3f05d2a8726
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/libunwind/gnu-install-dirs.patch
@@ -0,0 +1,65 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index e3cc66dd2226..1299b596ce0d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,8 @@ endif()
+ 
+ cmake_minimum_required(VERSION 3.13.4)
+ 
++include(GNUInstallDirs)
++
+ set(LLVM_COMMON_CMAKE_UTILS "${CMAKE_CURRENT_SOURCE_DIR}/../cmake")
+ 
+ # Add path for custom modules
+@@ -139,25 +141,27 @@ set(CMAKE_MODULE_PATH
+ 
+ if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND NOT APPLE)
+   set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
+-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
++  set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/${LLVM_DEFAULT_TARGET_TRIPLE}" CACHE PATH
++      "Path where built libunwind headers should be installed.")
++  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/${LLVM_DEFAULT_TARGET_TRIPLE} CACHE PATH
+       "Path where built libunwind libraries should be installed.")
+-  set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libunwind runtime libraries should be installed.")
+   if(LIBCXX_LIBDIR_SUBDIR)
+     string(APPEND LIBUNWIND_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+     string(APPEND LIBUNWIND_INSTALL_LIBRARY_DIR /${LIBUNWIND_LIBDIR_SUBDIR})
+   endif()
+-elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
+-  set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
+-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
+-      "Path where built libunwind libraries should be installed.")
+-  set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
+-      "Path where built libunwind runtime libraries should be installed.")
+ else()
+-  set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
+-  set(LIBUNWIND_INSTALL_LIBRARY_DIR lib${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
++  if(LLVM_LIBRARY_OUTPUT_INTDIR)
++    set(LIBUNWIND_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
++  else()
++    set(LIBUNWIND_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LIBUNWIND_LIBDIR_SUFFIX})
++  endif()
++  set(LIBUNWIND_INSTALL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH
++      "Path where built libunwind headers should be installed.")
++  set(LIBUNWIND_INSTALL_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}${LIBUNWIND_LIBDIR_SUFFIX} CACHE PATH
+       "Path where built libunwind libraries should be installed.")
+-  set(LIBUNWIND_INSTALL_RUNTIME_DIR bin CACHE PATH
++  set(LIBUNWIND_INSTALL_RUNTIME_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH
+       "Path where built libunwind runtime libraries should be installed.")
+ endif()
+ 
+diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
+index c3bb1dd0f69f..adf1766c44cb 100644
+--- a/include/CMakeLists.txt
++++ b/include/CMakeLists.txt
+@@ -14,7 +14,7 @@ if(LIBUNWIND_INSTALL_HEADERS)
+   foreach(file ${files})
+     get_filename_component(dir ${file} DIRECTORY)
+     install(FILES ${file}
+-      DESTINATION "include/${dir}"
++      DESTINATION "${LIBUNWIND_INSTALL_INCLUDE_DIR}/${dir}"
+       COMPONENT unwind-headers
+       PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+     )
diff --git a/pkgs/development/compilers/llvm/14/lld/default.nix b/pkgs/development/compilers/llvm/14/lld/default.nix
new file mode 100644
index 00000000000..fe655c76112
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lld/default.nix
@@ -0,0 +1,55 @@
+{ lib, stdenv, llvm_meta
+, buildLlvmTools
+, monorepoSrc, runCommand
+, cmake
+, libxml2
+, libllvm
+, version
+}:
+
+stdenv.mkDerivation rec {
+  pname = "lld";
+  inherit version;
+
+  # Blank llvm dir just so relative path works
+  src = runCommand "${pname}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${pname} "$out"
+    mkdir -p "$out/libunwind"
+    cp -r ${monorepoSrc}/libunwind/include "$out/libunwind"
+    mkdir -p "$out/llvm"
+  '';
+
+  sourceRoot = "${src.name}/${pname}";
+
+  patches = [
+    ./gnu-install-dirs.patch
+    # On Darwin the llvm-config is perhaps not working fine as the
+    # LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as
+    # the include path is not correct.
+    ./fix-root-src-dir.patch
+  ];
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ libllvm libxml2 ];
+
+  cmakeFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "-DLLVM_TABLEGEN_EXE=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+  ];
+
+  outputs = [ "out" "lib" "dev" ];
+
+  meta = llvm_meta // {
+    homepage = "https://lld.llvm.org/";
+    description = "The LLVM linker";
+    longDescription = ''
+      LLD is a linker from the LLVM project that is a drop-in replacement for
+      system linkers and runs much faster than them. It also provides features
+      that are useful for toolchain developers.
+      The linker supports ELF (Unix), PE/COFF (Windows), Mach-O (macOS), and
+      WebAssembly in descending order of completeness. Internally, LLD consists
+      of several different linkers.
+    '';
+  };
+}
diff --git a/pkgs/development/compilers/llvm/14/lld/fix-root-src-dir.patch b/pkgs/development/compilers/llvm/14/lld/fix-root-src-dir.patch
new file mode 100644
index 00000000000..26ecef25649
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lld/fix-root-src-dir.patch
@@ -0,0 +1,13 @@
+diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt
+index e1a29b884d17..9d542f8fbfc1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -64,7 +64,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ 
+   set(LLVM_MAIN_INCLUDE_DIR ${MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
+   set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree")
+-  set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree")
++  set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH "Path to LLVM source tree")
+ 
+   find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR}
+     NO_DEFAULT_PATH)
diff --git a/pkgs/development/compilers/llvm/14/lld/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/lld/gnu-install-dirs.patch
new file mode 100644
index 00000000000..89a5822df49
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lld/gnu-install-dirs.patch
@@ -0,0 +1,22 @@
+diff --git a/cmake/modules/AddLLD.cmake b/cmake/modules/AddLLD.cmake
+index dd2898ce6236..ebbea040ff54 100644
+--- a/cmake/modules/AddLLD.cmake
++++ b/cmake/modules/AddLLD.cmake
+@@ -18,8 +18,8 @@ macro(add_lld_library name)
+     install(TARGETS ${name}
+       COMPONENT ${name}
+       ${export_to_lldtargets}
+-      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+-      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
++      LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}"
++      ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}"
+       RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
+ 
+     if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES)
+@@ -62,5 +62,5 @@ endmacro()
+ macro(add_lld_symlink name dest)
+   add_llvm_tool_symlink(${name} ${dest} ALWAYS_GENERATE)
+   # Always generate install targets
+-  llvm_install_symlink(${name} ${dest} ALWAYS_GENERATE)
++  llvm_install_symlink(${name} ${dest} ${CMAKE_INSTALL_FULL_BINDIR} ALWAYS_GENERATE)
+ endmacro()
diff --git a/pkgs/development/compilers/llvm/14/lldb/default.nix b/pkgs/development/compilers/llvm/14/lldb/default.nix
new file mode 100644
index 00000000000..a2c68b22477
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lldb/default.nix
@@ -0,0 +1,144 @@
+{ lib, stdenv, llvm_meta
+, runCommand
+, monorepoSrc
+, cmake
+, zlib
+, ncurses
+, swig
+, which
+, libedit
+, libxml2
+, libllvm
+, libclang
+, python3
+, version
+, libobjc
+, xpc
+, Foundation
+, bootstrap_cmds
+, Carbon
+, Cocoa
+, lit
+, makeWrapper
+, enableManpages ? false
+}:
+
+stdenv.mkDerivation (rec {
+  pname = "lldb";
+  inherit version;
+
+  src = runCommand "${pname}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${pname} "$out"
+  '';
+
+  sourceRoot = "${src.name}/${pname}";
+
+  patches = [
+    ./procfs.patch
+    (runCommand "resource-dir.patch" {
+      clangLibDir = "${libclang.lib}/lib";
+    } ''
+      substitute '${./resource-dir.patch}' "$out" --subst-var clangLibDir
+    '')
+    ./gnu-install-dirs.patch
+  ];
+
+  outputs = [ "out" "lib" "dev" ];
+
+  nativeBuildInputs = [
+    cmake python3 which swig lit makeWrapper
+  ] ++ lib.optionals enableManpages [
+    python3.pkgs.sphinx python3.pkgs.recommonmark
+  ];
+
+  buildInputs = [
+    ncurses
+    zlib
+    libedit
+    libxml2
+    libllvm
+  ] ++ lib.optionals stdenv.isDarwin [
+    libobjc
+    xpc
+    Foundation
+    bootstrap_cmds
+    Carbon
+    Cocoa
+  ];
+
+  hardeningDisable = [ "format" ];
+
+  cmakeFlags = [
+    "-DLLDB_INCLUDE_TESTS=${if doCheck then "YES" else "NO"}"
+    "-DLLVM_ENABLE_RTTI=OFF"
+    "-DClang_DIR=${libclang.dev}/lib/cmake"
+    "-DLLVM_EXTERNAL_LIT=${lit}/bin/lit"
+  ] ++ lib.optionals stdenv.isDarwin [
+    "-DLLDB_USE_SYSTEM_DEBUGSERVER=ON"
+  ] ++ lib.optionals (!stdenv.isDarwin) [
+    "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+  ] ++ lib.optionals enableManpages [
+    "-DLLVM_ENABLE_SPHINX=ON"
+    "-DSPHINX_OUTPUT_MAN=ON"
+    "-DSPHINX_OUTPUT_HTML=OFF"
+  ] ++ lib.optionals doCheck [
+    "-DLLDB_TEST_C_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
+    "-DLLDB_TEST_CXX_COMPILER=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++"
+  ];
+
+  doCheck = false;
+
+  installCheckPhase = ''
+    if [ ! -e "$lib/${python3.sitePackages}/lldb/_lldb.so" ] ; then
+        return 1;
+    fi
+  '';
+
+  postInstall = ''
+    wrapProgram $out/bin/lldb --prefix PYTHONPATH : $lib/${python3.sitePackages}/
+
+    # Editor support
+    # vscode:
+    install -D ../tools/lldb-vscode/package.json $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/package.json
+    mkdir -p $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+    ln -s $out/bin/lldb-vscode $out/share/vscode/extensions/llvm-org.lldb-vscode-0.1.0/bin
+  '';
+
+  meta = llvm_meta // {
+    homepage = "https://lldb.llvm.org/";
+    description = "A next-generation high-performance debugger";
+    longDescription = ''
+      LLDB is a next generation, high-performance debugger. It is built as a set
+      of reusable components which highly leverage existing libraries in the
+      larger LLVM Project, such as the Clang expression parser and LLVM
+      disassembler.
+    '';
+  };
+} // lib.optionalAttrs enableManpages {
+  pname = "lldb-manpages";
+
+  buildPhase = ''
+    make docs-lldb-man
+  '';
+
+  propagatedBuildInputs = [];
+
+  # manually install lldb man page
+  installPhase = ''
+    mkdir -p $out/share/man/man1
+    install docs/man/lldb.1 -t $out/share/man/man1/
+  '';
+
+  postPatch = null;
+  postInstall = null;
+
+  outputs = [ "out" ];
+
+  doCheck = false;
+
+  meta = llvm_meta // {
+    description = "man pages for LLDB ${version}";
+  };
+})
diff --git a/pkgs/development/compilers/llvm/14/lldb/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/lldb/gnu-install-dirs.patch
new file mode 100644
index 00000000000..f69ed9e162f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lldb/gnu-install-dirs.patch
@@ -0,0 +1,36 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 79d451965ed4..78188978d6de 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -12,6 +12,8 @@ set(CMAKE_MODULE_PATH
+ # If we are not building as part of LLVM, build LLDB as a standalone project,
+ # using LLVM as an external library.
+ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
++  include(GNUInstallDirs)
++
+   project(lldb)
+   include(LLDBStandalone)
+ 
+diff --git a/cmake/modules/AddLLDB.cmake b/cmake/modules/AddLLDB.cmake
+index 3291a7c808e1..b27d27ce6a87 100644
+--- a/cmake/modules/AddLLDB.cmake
++++ b/cmake/modules/AddLLDB.cmake
+@@ -109,7 +109,7 @@ function(add_lldb_library name)
+   endif()
+ 
+   if(PARAM_SHARED)
+-    set(install_dest lib${LLVM_LIBDIR_SUFFIX})
++    set(install_dest ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+     if(PARAM_INSTALL_PREFIX)
+       set(install_dest ${PARAM_INSTALL_PREFIX})
+     endif()
+diff --git a/tools/intel-features/CMakeLists.txt b/tools/intel-features/CMakeLists.txt
+index 7d48491ec89a..c04543585588 100644
+--- a/tools/intel-features/CMakeLists.txt
++++ b/tools/intel-features/CMakeLists.txt
+@@ -30,4 +30,4 @@ add_lldb_library(lldbIntelFeatures SHARED
+   )
+ 
+ install(TARGETS lldbIntelFeatures
+-  LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
diff --git a/pkgs/development/compilers/llvm/14/lldb/procfs.patch b/pkgs/development/compilers/llvm/14/lldb/procfs.patch
new file mode 100644
index 00000000000..b075dbaeee0
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lldb/procfs.patch
@@ -0,0 +1,31 @@
+--- a/source/Plugins/Process/Linux/Procfs.h
++++ b/source/Plugins/Process/Linux/Procfs.h
+@@ -11,21 +11,12 @@
+ // sys/procfs.h on Android/Linux for all supported architectures.
+ 
+ #include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ 
+-#ifdef __ANDROID__
+-#if defined(__arm64__) || defined(__aarch64__)
+-typedef unsigned long elf_greg_t;
+-typedef elf_greg_t
+-    elf_gregset_t[(sizeof(struct user_pt_regs) / sizeof(elf_greg_t))];
+-typedef struct user_fpsimd_state elf_fpregset_t;
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#elif defined(__mips__)
+-#ifndef NT_FPREGSET
+-#define NT_FPREGSET NT_PRFPREG
+-#endif // NT_FPREGSET
+-#endif
+-#else // __ANDROID__
++#if !defined(__GLIBC__) && defined(__powerpc__)
++#define pt_regs musl_pt_regs
++#include <sys/procfs.h>
++#undef pt_regs
++#else
+ #include <sys/procfs.h>
+-#endif // __ANDROID__
++#endif
diff --git a/pkgs/development/compilers/llvm/14/lldb/resource-dir.patch b/pkgs/development/compilers/llvm/14/lldb/resource-dir.patch
new file mode 100644
index 00000000000..e0db80afeb9
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/lldb/resource-dir.patch
@@ -0,0 +1,13 @@
+diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
+index 37364341ff8b..7f74c1a3e257 100644
+--- a/cmake/modules/LLDBConfig.cmake
++++ b/cmake/modules/LLDBConfig.cmake
+@@ -257,7 +257,7 @@ if (NOT TARGET clang-resource-headers)
+   # Iterate over the possible places where the external resource directory
+   # could be and pick the first that exists.
+   foreach(CANDIDATE "${Clang_DIR}/../.." "${LLVM_DIR}" "${LLVM_LIBRARY_DIRS}"
+-                    "${LLVM_BUILD_LIBRARY_DIR}"
++                    "${LLVM_BUILD_LIBRARY_DIR}" "@clangLibDir@"
+                     "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
+     # Build the resource directory path by appending 'clang/<version number>'.
+     set(CANDIDATE_RESOURCE_DIR "${CANDIDATE}/clang/${LLDB_CLANG_RESOURCE_DIR_NAME}")
diff --git a/pkgs/development/compilers/llvm/14/llvm/default.nix b/pkgs/development/compilers/llvm/14/llvm/default.nix
new file mode 100644
index 00000000000..d2059cc66ba
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/llvm/default.nix
@@ -0,0 +1,254 @@
+{ lib, stdenv, llvm_meta
+, pkgsBuildBuild
+, monorepoSrc
+, runCommand
+, fetchpatch
+, cmake
+, python3
+, libffi
+, libbfd
+, libpfm
+, libxml2
+, ncurses
+, version
+, release_version
+, zlib
+, which
+, buildLlvmTools
+, debugVersion ? false
+, enableManpages ? false
+, enableSharedLibraries ? !stdenv.hostPlatform.isStatic
+, enablePFM ? !(stdenv.isDarwin
+  || stdenv.isAarch64 # broken for Ampere eMAG 8180 (c2.large.arm on Packet) #56245
+  || stdenv.isAarch32 # broken for the armv7l builder
+)
+, enablePolly ? false
+} @args:
+
+let
+  inherit (lib) optional optionals optionalString;
+
+  # Used when creating a version-suffixed symlink of libLLVM.dylib
+  shortVersion = with lib;
+    concatStringsSep "." (take 1 (splitString "." release_version));
+
+in stdenv.mkDerivation (rec {
+  pname = "llvm";
+  inherit version;
+
+  src = runCommand "${pname}-src-${version}" {} (''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${pname} "$out"
+    cp -r ${monorepoSrc}/third-party "$out"
+  '' + lib.optionalString enablePolly ''
+    cp -r ${monorepoSrc}/polly "$out/llvm/tools"
+  '');
+
+  sourceRoot = "${src.name}/${pname}";
+
+  outputs = [ "out" "lib" "dev" "python" ];
+
+  nativeBuildInputs = [ cmake python3 ]
+    ++ optionals enableManpages [ python3.pkgs.sphinx python3.pkgs.recommonmark ];
+
+  buildInputs = [ libxml2 libffi ]
+    ++ optional enablePFM libpfm; # exegesis
+
+  propagatedBuildInputs = [ ncurses zlib ];
+
+  checkInputs = [ which ];
+
+  patches = [
+    ./gnu-install-dirs.patch
+  ] ++ lib.optional enablePolly ./gnu-install-dirs-polly.patch;
+
+  postPatch = optionalString stdenv.isDarwin ''
+    substituteInPlace cmake/modules/AddLLVM.cmake \
+      --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir)" \
+      --replace 'set(_install_rpath "@loader_path/../''${CMAKE_INSTALL_LIBDIR}''${LLVM_LIBDIR_SUFFIX}" ''${extra_libdir})' ""
+  '' + ''
+    # FileSystem permissions tests fail with various special bits
+    substituteInPlace unittests/Support/CMakeLists.txt \
+      --replace "Path.cpp" ""
+    rm unittests/Support/Path.cpp
+    substituteInPlace unittests/IR/CMakeLists.txt \
+      --replace "PassBuilderCallbacksTest.cpp" ""
+    rm unittests/IR/PassBuilderCallbacksTest.cpp
+    rm test/tools/llvm-objcopy/ELF/mirror-permissions-unix.test
+  '' + optionalString stdenv.hostPlatform.isMusl ''
+    patch -p1 -i ${../../TLI-musl.patch}
+    substituteInPlace unittests/Support/CMakeLists.txt \
+      --replace "add_subdirectory(DynamicLibrary)" ""
+    rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+    # valgrind unhappy with musl or glibc, but fails w/musl only
+    rm test/CodeGen/AArch64/wineh4.mir
+  '' + optionalString stdenv.hostPlatform.isAarch32 ''
+    # skip failing X86 test cases on 32-bit ARM
+    rm test/DebugInfo/X86/convert-debugloc.ll
+    rm test/DebugInfo/X86/convert-inlined.ll
+    rm test/DebugInfo/X86/convert-linked.ll
+    rm test/tools/dsymutil/X86/op-convert.test
+  '' + optionalString (stdenv.hostPlatform.system == "armv6l-linux") ''
+    # Seems to require certain floating point hardware (NEON?)
+    rm test/ExecutionEngine/frem.ll
+  '' + ''
+    patchShebangs test/BugPoint/compile-custom.ll.py
+  '';
+
+  # hacky fix: created binaries need to be run before installation
+  preBuild = ''
+    mkdir -p $out/
+    ln -sv $PWD/lib $out
+  '';
+
+  # E.g. mesa.drivers use the build-id as a cache key (see #93946):
+  LDFLAGS = optionalString (enableSharedLibraries && !stdenv.isDarwin) "-Wl,--build-id=sha1";
+
+  cmakeFlags = with stdenv; let
+    # These flags influence llvm-config's BuildVariables.inc in addition to the
+    # general build. We need to make sure these are also passed via
+    # CROSS_TOOLCHAIN_FLAGS_NATIVE when cross-compiling or llvm-config-native
+    # will return different results from the cross llvm-config.
+    #
+    # Some flags don't need to be repassed because LLVM already does so (like
+    # CMAKE_BUILD_TYPE), others are irrelevant to the result.
+    flagsForLlvmConfig = [
+      "-DLLVM_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake/llvm/"
+      "-DLLVM_ENABLE_RTTI=ON"
+    ] ++ optionals enableSharedLibraries [
+      "-DLLVM_LINK_LLVM_DYLIB=ON"
+    ];
+  in flagsForLlvmConfig ++ [
+    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
+    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
+    "-DLLVM_BUILD_TESTS=${if doCheck then "ON" else "OFF"}"
+    "-DLLVM_ENABLE_FFI=ON"
+    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
+    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
+    "-DLLVM_ENABLE_DUMP=ON"
+  ] ++ optionals stdenv.hostPlatform.isStatic [
+    # Disables building of shared libs, -fPIC is still injected by cc-wrapper
+    "-DLLVM_ENABLE_PIC=OFF"
+    "-DLLVM_BUILD_STATIC=ON"
+    # libxml2 needs to be disabled because the LLVM build system ignores its .la
+    # file and doesn't link zlib as well.
+    # https://github.com/ClangBuiltLinux/tc-build/issues/150#issuecomment-845418812
+    "-DLLVM_ENABLE_LIBXML2=OFF"
+  ] ++ optionals enableManpages [
+    "-DLLVM_BUILD_DOCS=ON"
+    "-DLLVM_ENABLE_SPHINX=ON"
+    "-DSPHINX_OUTPUT_MAN=ON"
+    "-DSPHINX_OUTPUT_HTML=OFF"
+    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+  ] ++ optionals (!isDarwin) [
+    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
+  ] ++ optionals isDarwin [
+    "-DLLVM_ENABLE_LIBCXX=ON"
+    "-DCAN_TARGET_i386=false"
+  ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "-DCMAKE_CROSSCOMPILING=True"
+    "-DLLVM_TABLEGEN=${buildLlvmTools.llvm}/bin/llvm-tblgen"
+    (
+      let
+        nativeCC = pkgsBuildBuild.targetPackages.stdenv.cc;
+        nativeBintools = nativeCC.bintools.bintools;
+        nativeToolchainFlags = [
+          "-DCMAKE_C_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}cc"
+          "-DCMAKE_CXX_COMPILER=${nativeCC}/bin/${nativeCC.targetPrefix}c++"
+          "-DCMAKE_AR=${nativeBintools}/bin/${nativeBintools.targetPrefix}ar"
+          "-DCMAKE_STRIP=${nativeBintools}/bin/${nativeBintools.targetPrefix}strip"
+          "-DCMAKE_RANLIB=${nativeBintools}/bin/${nativeBintools.targetPrefix}ranlib"
+        ];
+        # We need to repass the custom GNUInstallDirs values, otherwise CMake
+        # will choose them for us, leading to wrong results in llvm-config-native
+        nativeInstallFlags = [
+          "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
+          "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+          "-DCMAKE_INSTALL_INCLUDEDIR=${placeholder "dev"}/include"
+          "-DCMAKE_INSTALL_LIBDIR=${placeholder "lib"}/lib"
+          "-DCMAKE_INSTALL_LIBEXECDIR=${placeholder "lib"}/libexec"
+        ];
+      in "-DCROSS_TOOLCHAIN_FLAGS_NATIVE:list="
+      + lib.concatStringsSep ";" (lib.concatLists [
+        flagsForLlvmConfig
+        nativeToolchainFlags
+        nativeInstallFlags
+      ])
+    )
+  ];
+
+  postBuild = ''
+    rm -fR $out
+  '';
+
+  preCheck = ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$PWD/lib
+  '';
+
+  postInstall = ''
+    mkdir -p $python/share
+    mv $out/share/opt-viewer $python/share/opt-viewer
+    moveToOutput "bin/llvm-config*" "$dev"
+    substituteInPlace "$dev/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+      --replace "\''${_IMPORT_PREFIX}/lib/lib" "$lib/lib/lib" \
+      --replace "$out/bin/llvm-config" "$dev/bin/llvm-config"
+    substituteInPlace "$dev/lib/cmake/llvm/LLVMConfig.cmake" \
+      --replace 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}")' 'set(LLVM_BINARY_DIR "''${LLVM_INSTALL_PREFIX}'"$lib"'")'
+  ''
+  + optionalString (stdenv.isDarwin && enableSharedLibraries) ''
+    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
+    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+  ''
+  + optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+    cp NATIVE/bin/llvm-config $dev/bin/llvm-config-native
+  '';
+
+  doCheck = stdenv.isLinux && (!stdenv.isx86_32) && (!stdenv.hostPlatform.isMusl)
+    && (stdenv.hostPlatform == stdenv.buildPlatform);
+
+  checkTarget = "check-all";
+
+  requiredSystemFeatures = [ "big-parallel" ];
+  meta = llvm_meta // {
+    homepage = "https://llvm.org/";
+    description = "A collection of modular and reusable compiler and toolchain technologies";
+    longDescription = ''
+      The LLVM Project is a collection of modular and reusable compiler and
+      toolchain technologies. Despite its name, LLVM has little to do with
+      traditional virtual machines. The name "LLVM" itself is not an acronym; it
+      is the full name of the project.
+      LLVM began as a research project at the University of Illinois, with the
+      goal of providing a modern, SSA-based compilation strategy capable of
+      supporting both static and dynamic compilation of arbitrary programming
+      languages. Since then, LLVM has grown to be an umbrella project consisting
+      of a number of subprojects, many of which are being used in production by
+      a wide variety of commercial and open source projects as well as being
+      widely used in academic research. Code in the LLVM project is licensed
+      under the "Apache 2.0 License with LLVM exceptions".
+    '';
+  };
+} // lib.optionalAttrs enableManpages {
+  pname = "llvm-manpages";
+
+  buildPhase = ''
+    make docs-llvm-man
+  '';
+
+  propagatedBuildInputs = [];
+
+  installPhase = ''
+    make -C docs install
+  '';
+
+  postPatch = null;
+  postInstall = null;
+
+  outputs = [ "out" ];
+
+  doCheck = false;
+
+  meta = llvm_meta // {
+    description = "man pages for LLVM ${version}";
+  };
+})
diff --git a/pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs-polly.patch b/pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs-polly.patch
new file mode 100644
index 00000000000..98e998e65a9
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs-polly.patch
@@ -0,0 +1,102 @@
+diff --git a/tools/polly/CMakeLists.txt b/tools/polly/CMakeLists.txt
+index ca7c04c565bb..6a6155806ffa 100644
+--- a/tools/polly/CMakeLists.txt
++++ b/tools/polly/CMakeLists.txt
+@@ -3,6 +3,8 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
+   project(Polly)
+   cmake_minimum_required(VERSION 3.13.4)
+ 
++  include(GNUInstallDirs)
++
+   # Where is LLVM installed?
+   find_package(LLVM CONFIG REQUIRED)
+   set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${LLVM_CMAKE_DIR})
+@@ -122,13 +124,13 @@ include_directories(
+ 
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+   install(DIRECTORY include/
+-    DESTINATION include
++    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+     FILES_MATCHING
+     PATTERN "*.h"
+     )
+ 
+   install(DIRECTORY ${POLLY_BINARY_DIR}/include/
+-    DESTINATION include
++    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+     FILES_MATCHING
+     PATTERN "*.h"
+     PATTERN "CMakeFiles" EXCLUDE
+diff --git a/tools/polly/cmake/CMakeLists.txt b/tools/polly/cmake/CMakeLists.txt
+index 7cc129ba2e90..137be25e4b80 100644
+--- a/tools/polly/cmake/CMakeLists.txt
++++ b/tools/polly/cmake/CMakeLists.txt
+@@ -79,18 +79,18 @@ file(GENERATE
+ 
+ # Generate PollyConfig.cmake for the install tree.
+ unset(POLLY_EXPORTS)
+-set(POLLY_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
++set(POLLY_INSTALL_PREFIX "")
+ set(POLLY_CONFIG_LLVM_CMAKE_DIR "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
+-set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}")
++set(POLLY_CONFIG_CMAKE_DIR "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_PREFIX}/${POLLY_INSTALL_PACKAGE_DIR}")
++set(POLLY_CONFIG_LIBRARY_DIRS "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ if (POLLY_BUNDLED_ISL)
+   set(POLLY_CONFIG_INCLUDE_DIRS
+-    "${POLLY_INSTALL_PREFIX}/include"
+-    "${POLLY_INSTALL_PREFIX}/include/polly"
++    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}"
++    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_LIBDIR}/polly"
+     )
+ else()
+   set(POLLY_CONFIG_INCLUDE_DIRS
+-    "${POLLY_INSTALL_PREFIX}/include"
++    "${POLLY_INSTALL_PREFIX}${CMAKE_INSTALL_FULL_INCLUDEDIR}"
+     ${ISL_INCLUDE_DIRS}
+     )
+ endif()
+@@ -100,12 +100,12 @@ endif()
+ foreach(tgt IN LISTS POLLY_CONFIG_EXPORTED_TARGETS)
+   get_target_property(tgt_type ${tgt} TYPE)
+   if (tgt_type STREQUAL "EXECUTABLE")
+-    set(tgt_prefix "bin/")
++    set(tgt_prefix "${CMAKE_INSTALL_BINDIR}/")
+   else()
+-    set(tgt_prefix "lib/")
++    set(tgt_prefix "${CMAKE_INSTALL_LIBDIR}/")
+   endif()
+ 
+-  set(tgt_path "${CMAKE_INSTALL_PREFIX}/${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
++  set(tgt_path "${tgt_prefix}$<TARGET_FILE_NAME:${tgt}>")
+   file(RELATIVE_PATH tgt_path ${POLLY_CONFIG_CMAKE_DIR} ${tgt_path})
+ 
+   if (NOT tgt_type STREQUAL "INTERFACE_LIBRARY")
+diff --git a/tools/polly/cmake/polly_macros.cmake b/tools/polly/cmake/polly_macros.cmake
+index 518a09b45a42..bd9d6f5542ad 100644
+--- a/tools/polly/cmake/polly_macros.cmake
++++ b/tools/polly/cmake/polly_macros.cmake
+@@ -44,8 +44,8 @@ macro(add_polly_library name)
+   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LLVMPolly")
+     install(TARGETS ${name}
+       EXPORT LLVMExports
+-      LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+-      ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
++	  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}
++      ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+   endif()
+   set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ endmacro(add_polly_library)
+diff --git a/tools/polly/lib/External/CMakeLists.txt b/tools/polly/lib/External/CMakeLists.txt
+index e3a5683fccdc..293b482eb28a 100644
+--- a/tools/polly/lib/External/CMakeLists.txt
++++ b/tools/polly/lib/External/CMakeLists.txt
+@@ -290,7 +290,7 @@ if (POLLY_BUNDLED_ISL)
+     install(DIRECTORY
+       ${ISL_SOURCE_DIR}/include/
+       ${ISL_BINARY_DIR}/include/
+-      DESTINATION include/polly
++      DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polly
+       FILES_MATCHING
+       PATTERN "*.h"
+       PATTERN "CMakeFiles" EXCLUDE
diff --git a/pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs.patch
new file mode 100644
index 00000000000..55862ab3930
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/llvm/gnu-install-dirs.patch
@@ -0,0 +1,220 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index fec956091cd5..5a766f5c5d7c 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -303,6 +303,9 @@ set(LLVM_EXAMPLES_INSTALL_DIR "examples" CACHE STRING
+     "Path for examples subdirectory (enabled by LLVM_BUILD_EXAMPLES=ON) (defaults to 'examples')")
+ mark_as_advanced(LLVM_EXAMPLES_INSTALL_DIR)
+ 
++set(LLVM_INSTALL_CMAKE_DIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}/cmake/llvm" CACHE STRING
++	"Path for CMake subdirectory (defaults to lib/cmake/llvm)" )
++
+ # They are used as destination of target generators.
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})
+diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
+index fed1fec7d72e..4baed19b9e98 100644
+--- a/cmake/modules/AddLLVM.cmake
++++ b/cmake/modules/AddLLVM.cmake
+@@ -838,8 +838,8 @@ macro(add_llvm_library name)
+       get_target_export_arg(${name} LLVM export_to_llvmexports ${umbrella})
+       install(TARGETS ${name}
+               ${export_to_llvmexports}
+-              LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
+-              ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT ${name}
++              LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" COMPONENT ${name}
++              ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" COMPONENT ${name}
+               RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT ${name})
+ 
+       if (NOT LLVM_ENABLE_IDE)
+@@ -1056,7 +1056,7 @@ function(process_llvm_pass_plugins)
+           "set(LLVM_STATIC_EXTENSIONS ${LLVM_STATIC_EXTENSIONS})")
+       install(FILES
+           ${llvm_cmake_builddir}/LLVMConfigExtensions.cmake
+-          DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
++          DESTINATION ${LLVM_INSTALL_CMAKE_DIR}
+           COMPONENT cmake-exports)
+ 
+       set(ExtensionDef "${LLVM_BINARY_DIR}/include/llvm/Support/Extension.def")
+@@ -1902,7 +1902,7 @@ function(llvm_install_library_symlink name dest type)
+   set(full_name ${CMAKE_${type}_LIBRARY_PREFIX}${name}${CMAKE_${type}_LIBRARY_SUFFIX})
+   set(full_dest ${CMAKE_${type}_LIBRARY_PREFIX}${dest}${CMAKE_${type}_LIBRARY_SUFFIX})
+ 
+-  set(output_dir lib${LLVM_LIBDIR_SUFFIX})
++  set(output_dir ${CMAKE_INSTALL_FULL_LIBDIR}${LLVM_LIBDIR_SUFFIX})
+   if(WIN32 AND "${type}" STREQUAL "SHARED")
+     set(output_dir bin)
+   endif()
+@@ -1913,7 +1913,7 @@ function(llvm_install_library_symlink name dest type)
+ 
+ endfunction()
+ 
+-function(llvm_install_symlink name dest)
++function(llvm_install_symlink name dest output_dir)
+   cmake_parse_arguments(ARG "ALWAYS_GENERATE" "COMPONENT" "" ${ARGN})
+   foreach(path ${CMAKE_MODULE_PATH})
+     if(EXISTS ${path}/LLVMInstallSymlink.cmake)
+@@ -1936,7 +1936,7 @@ function(llvm_install_symlink name dest)
+   set(full_dest ${dest}${CMAKE_EXECUTABLE_SUFFIX})
+ 
+   install(SCRIPT ${INSTALL_SYMLINK}
+-          CODE "install_symlink(${full_name} ${full_dest} ${LLVM_TOOLS_INSTALL_DIR})"
++          CODE "install_symlink(${full_name} ${full_dest} ${output_dir})"
+           COMPONENT ${component})
+ 
+   if (NOT LLVM_ENABLE_IDE AND NOT ARG_ALWAYS_GENERATE)
+@@ -2019,7 +2019,8 @@ function(add_llvm_tool_symlink link_name target)
+     endif()
+ 
+     if ((TOOL_IS_TOOLCHAIN OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) AND LLVM_BUILD_TOOLS)
+-      llvm_install_symlink(${link_name} ${target})
++      GNUInstallDirs_get_absolute_install_dir(output_dir LLVM_TOOLS_INSTALL_DIR)
++      llvm_install_symlink(${link_name} ${target} ${output_dir})
+     endif()
+   endif()
+ endfunction()
+@@ -2148,9 +2149,9 @@ function(llvm_setup_rpath name)
+     # Since BUILD_SHARED_LIBS is only recommended for use by developers,
+     # hardcode the rpath to build/install lib dir first in this mode.
+     # FIXME: update this when there is better solution.
+-    set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++    set(_install_rpath "${LLVM_LIBRARY_OUTPUT_INTDIR}" "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+   elseif(UNIX)
+-    set(_install_rpath "\$ORIGIN/../lib${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
++    set(_install_rpath "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}" ${extra_libdir})
+     if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+       set_property(TARGET ${name} APPEND_STRING PROPERTY
+                    LINK_FLAGS " -Wl,-z,origin ")
+diff --git a/cmake/modules/AddOCaml.cmake b/cmake/modules/AddOCaml.cmake
+index 891c9e6d618c..8d963f3b0069 100644
+--- a/cmake/modules/AddOCaml.cmake
++++ b/cmake/modules/AddOCaml.cmake
+@@ -147,9 +147,9 @@ function(add_ocaml_library name)
+   endforeach()
+ 
+   if( APPLE )
+-    set(ocaml_rpath "@executable_path/../../../lib${LLVM_LIBDIR_SUFFIX}")
++    set(ocaml_rpath "@executable_path/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+   elseif( UNIX )
+-    set(ocaml_rpath "\\$ORIGIN/../../../lib${LLVM_LIBDIR_SUFFIX}")
++    set(ocaml_rpath "\\$ORIGIN/../../../${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+   endif()
+   list(APPEND ocaml_flags "-ldopt" "-Wl,-rpath,${ocaml_rpath}")
+ 
+diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
+index cea0c1df0a14..eedcd9450312 100644
+--- a/cmake/modules/CMakeLists.txt
++++ b/cmake/modules/CMakeLists.txt
+@@ -2,7 +2,7 @@ include(ExtendPath)
+ include(LLVMDistributionSupport)
+ include(FindPrefixFromConfig)
+ 
+-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm)
++set(LLVM_INSTALL_PACKAGE_DIR ${LLVM_INSTALL_CMAKE_DIR} CACHE STRING "Path for CMake subdirectory (defaults to 'cmake/llvm')")
+ set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}")
+ 
+ # First for users who use an installed LLVM, create the LLVMExports.cmake file.
+@@ -122,7 +122,7 @@ set(LLVM_CONFIG_INCLUDE_DIRS
+   )
+ list(REMOVE_DUPLICATES LLVM_CONFIG_INCLUDE_DIRS)
+ 
+-extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "lib\${LLVM_LIBDIR_SUFFIX}")
++extend_path(LLVM_CONFIG_LIBRARY_DIR "\${LLVM_INSTALL_PREFIX}" "${CMAKE_INSTALL_LIBDIR}\${LLVM_LIBDIR_SUFFIX}")
+ set(LLVM_CONFIG_LIBRARY_DIRS
+   "${LLVM_CONFIG_LIBRARY_DIR}"
+   # FIXME: Should there be other entries here?
+diff --git a/cmake/modules/LLVMInstallSymlink.cmake b/cmake/modules/LLVMInstallSymlink.cmake
+index b5c35f706cb7..9261ab797de6 100644
+--- a/cmake/modules/LLVMInstallSymlink.cmake
++++ b/cmake/modules/LLVMInstallSymlink.cmake
+@@ -6,7 +6,7 @@ include(GNUInstallDirs)
+ 
+ function(install_symlink name target outdir)
+   set(DESTDIR $ENV{DESTDIR})
+-  set(bindir "${DESTDIR}${CMAKE_INSTALL_PREFIX}/${outdir}")
++  set(bindir "${DESTDIR}${outdir}/")
+ 
+   message(STATUS "Creating ${name}")
+ 
+diff --git a/docs/CMake.rst b/docs/CMake.rst
+index 044ec8a4d39d..504d0eac3ade 100644
+--- a/docs/CMake.rst
++++ b/docs/CMake.rst
+@@ -224,7 +224,7 @@ description is in `LLVM-related variables`_ below.
+ **LLVM_LIBDIR_SUFFIX**:STRING
+   Extra suffix to append to the directory where libraries are to be
+   installed. On a 64-bit architecture, one could use ``-DLLVM_LIBDIR_SUFFIX=64``
+-  to install libraries to ``/usr/lib64``.
++  to install libraries to ``/usr/lib64``. See also ``CMAKE_INSTALL_LIBDIR``.
+ 
+ **LLVM_PARALLEL_{COMPILE,LINK}_JOBS**:STRING
+   Building the llvm toolchain can use a lot of resources, particularly
+@@ -910,9 +910,11 @@ the ``cmake`` command or by setting it directly in ``ccmake`` or ``cmake-gui``).
+ 
+ This file is available in two different locations.
+ 
+-* ``<INSTALL_PREFIX>/lib/cmake/llvm/LLVMConfig.cmake`` where
+-  ``<INSTALL_PREFIX>`` is the install prefix of an installed version of LLVM.
+-  On Linux typically this is ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
++* ``<LLVM_INSTALL_PACKAGE_DIR>LLVMConfig.cmake`` where
++  ``<LLVM_INSTALL_PACKAGE_DIR>`` is the location where LLVM CMake modules are
++  installed as part of an installed version of LLVM. This is typically
++  ``cmake/llvm/`` within the lib directory. On Linux, this is typically
++  ``/usr/lib/cmake/llvm/LLVMConfig.cmake``.
+ 
+ * ``<LLVM_BUILD_ROOT>/lib/cmake/llvm/LLVMConfig.cmake`` where
+   ``<LLVM_BUILD_ROOT>`` is the root of the LLVM build tree. **Note: this is only
+diff --git a/include/llvm/CMakeLists.txt b/include/llvm/CMakeLists.txt
+index b46319f24fc8..2feabd1954e4 100644
+--- a/include/llvm/CMakeLists.txt
++++ b/include/llvm/CMakeLists.txt
+@@ -5,5 +5,5 @@ add_subdirectory(Frontend)
+ # If we're doing an out-of-tree build, copy a module map for generated
+ # header files into the build area.
+ if (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+-  configure_file(module.modulemap.build module.modulemap COPYONLY)
++  configure_file(module.modulemap.build ${LLVM_INCLUDE_DIR}/module.modulemap COPYONLY)
+ endif (NOT "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
+diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in
+index abbb8a450da6..70c497be12f5 100644
+--- a/tools/llvm-config/BuildVariables.inc.in
++++ b/tools/llvm-config/BuildVariables.inc.in
+@@ -23,7 +23,10 @@
+ #define LLVM_CXXFLAGS "@LLVM_CXXFLAGS@"
+ #define LLVM_BUILDMODE "@LLVM_BUILDMODE@"
+ #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@"
++#define LLVM_INSTALL_BINDIR "@CMAKE_INSTALL_BINDIR@"
++#define LLVM_INSTALL_LIBDIR "@CMAKE_INSTALL_LIBDIR@"
+ #define LLVM_INSTALL_INCLUDEDIR "@CMAKE_INSTALL_INCLUDEDIR@"
++#define LLVM_INSTALL_CMAKEDIR "@LLVM_INSTALL_CMAKE_DIR@"
+ #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@"
+ #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@"
+ #define LLVM_BUILD_SYSTEM "@LLVM_BUILD_SYSTEM@"
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 8ed88f33ead4..5e7184bab90d 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -363,12 +363,20 @@ int main(int argc, char **argv) {
+       ActiveIncludeDir = std::string(Path.str());
+     }
+     {
+-      SmallString<256> Path(LLVM_TOOLS_INSTALL_DIR);
++      SmallString<256> Path(LLVM_INSTALL_BINDIR);
+       sys::fs::make_absolute(ActivePrefix, Path);
+       ActiveBinDir = std::string(Path.str());
+     }
+-    ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX;
+-    ActiveCMakeDir = ActiveLibDir + "/cmake/llvm";
++    {
++      SmallString<256> Path(LLVM_INSTALL_LIBDIR LLVM_LIBDIR_SUFFIX);
++      sys::fs::make_absolute(ActivePrefix, Path);
++      ActiveLibDir = std::string(Path.str());
++    }
++    {
++      SmallString<256> Path(LLVM_INSTALL_CMAKEDIR);
++      sys::fs::make_absolute(ActivePrefix, Path);
++      ActiveCMakeDir = std::string(Path.str());
++    }
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
diff --git a/pkgs/development/compilers/llvm/14/openmp/default.nix b/pkgs/development/compilers/llvm/14/openmp/default.nix
new file mode 100644
index 00000000000..7add0c7ed46
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/openmp/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, stdenv
+, llvm_meta
+, monorepoSrc
+, runCommand
+, cmake
+, llvm
+, clang-unwrapped
+, perl
+, pkg-config
+, version
+}:
+
+stdenv.mkDerivation rec {
+  pname = "openmp";
+  inherit version;
+
+  src = runCommand "${pname}-src-${version}" {} ''
+    mkdir -p "$out"
+    cp -r ${monorepoSrc}/cmake "$out"
+    cp -r ${monorepoSrc}/${pname} "$out"
+  '';
+
+  sourceRoot = "${src.name}/${pname}";
+
+  patches = [
+    ./gnu-install-dirs.patch
+    ./fix-find-tool.patch
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  nativeBuildInputs = [ cmake perl pkg-config clang-unwrapped ];
+  buildInputs = [ llvm ];
+
+  cmakeFlags = [
+    "-DLIBOMPTARGET_BUILD_AMDGCN_BCLIB=OFF" # Building the AMDGCN device RTL currently fails
+  ];
+
+  meta = llvm_meta // {
+    homepage = "https://openmp.llvm.org/";
+    description = "Support for the OpenMP language";
+    longDescription = ''
+      The OpenMP subproject of LLVM contains the components required to build an
+      executable OpenMP program that are outside the compiler itself.
+      Contains the code for the runtime library against which code compiled by
+      "clang -fopenmp" must be linked before it can run and the library that
+      supports offload to target devices.
+    '';
+    # "All of the code is dual licensed under the MIT license and the UIUC
+    # License (a BSD-like license)":
+    license = with lib.licenses; [ mit ncsa ];
+  };
+}
diff --git a/pkgs/development/compilers/llvm/14/openmp/fix-find-tool.patch b/pkgs/development/compilers/llvm/14/openmp/fix-find-tool.patch
new file mode 100644
index 00000000000..b5d0e7b4177
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/openmp/fix-find-tool.patch
@@ -0,0 +1,54 @@
+diff --git a/libomptarget/DeviceRTL/CMakeLists.txt b/libomptarget/DeviceRTL/CMakeLists.txt
+index 242df638f80d..a4654e96371f 100644
+--- a/libomptarget/DeviceRTL/CMakeLists.txt
++++ b/libomptarget/DeviceRTL/CMakeLists.txt
+@@ -25,16 +25,16 @@ endif()
+ 
+ if (LLVM_DIR)
+   # Builds that use pre-installed LLVM have LLVM_DIR set.
+-  find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
++  find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
+   find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR}
+-    NO_DEFAULT_PATH)
+-  find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
++    REQUIRED)
++  find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
+   libomptarget_say("Building DeviceRTL. Using clang: ${CLANG_TOOL}")
+ elseif (LLVM_TOOL_CLANG_BUILD AND NOT CMAKE_CROSSCOMPILING AND NOT OPENMP_STANDALONE_BUILD)
+   # LLVM in-tree builds may use CMake target names to discover the tools.
+-  set(CLANG_TOOL $<TARGET_FILE:clang>)
+-  set(LINK_TOOL $<TARGET_FILE:llvm-link>)
+-  set(OPT_TOOL $<TARGET_FILE:opt>)
++  set(CLANG_TOOL $<TARGET_FILE:clang> REQUIRED)
++  set(LINK_TOOL $<TARGET_FILE:llvm-link> REQUIRED)
++  set(OPT_TOOL $<TARGET_FILE:opt> REQUIRED)
+   libomptarget_say("Building DeviceRTL. Using clang from in-tree build")
+ else()
+   libomptarget_say("Not building DeviceRTL. No appropriate clang found")
+diff --git a/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt b/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+index 3f4c02671aeb..be9f4677d7b5 100644
+--- a/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
++++ b/libomptarget/deviceRTLs/amdgcn/CMakeLists.txt
+@@ -38,16 +38,16 @@ endif()
+ 
+ if (LLVM_DIR)
+   # Builds that use pre-installed LLVM have LLVM_DIR set.
+-  find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
++  find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
+   find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR}
+-    NO_DEFAULT_PATH)
+-  find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
++    REQUIRED)
++  find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} REQUIRED)
+   libomptarget_say("Building AMDGCN device RTL. Using clang: ${CLANG_TOOL}")
+ elseif (LLVM_TOOL_CLANG_BUILD AND NOT CMAKE_CROSSCOMPILING AND NOT OPENMP_STANDALONE_BUILD)
+   # LLVM in-tree builds may use CMake target names to discover the tools.
+-  set(CLANG_TOOL $<TARGET_FILE:clang>)
+-  set(LINK_TOOL $<TARGET_FILE:llvm-link>)
+-  set(OPT_TOOL $<TARGET_FILE:opt>)
++  set(CLANG_TOOL $<TARGET_FILE:clang> REQUIRED)
++  set(LINK_TOOL $<TARGET_FILE:llvm-link> REQUIRED)
++  set(OPT_TOOL $<TARGET_FILE:opt> REQUIRED)
+   libomptarget_say("Building AMDGCN device RTL. Using clang from in-tree build")
+ else()
+   libomptarget_say("Not building AMDGCN device RTL. No appropriate clang found")
diff --git a/pkgs/development/compilers/llvm/14/openmp/gnu-install-dirs.patch b/pkgs/development/compilers/llvm/14/openmp/gnu-install-dirs.patch
new file mode 100644
index 00000000000..352a4692311
--- /dev/null
+++ b/pkgs/development/compilers/llvm/14/openmp/gnu-install-dirs.patch
@@ -0,0 +1,89 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7f11a05f5622..fb90f8f6a49b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -8,6 +8,8 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
+   set(OPENMP_STANDALONE_BUILD TRUE)
+   project(openmp C CXX)
+ 
++  include(GNUInstallDirs)
++
+   # CMAKE_BUILD_TYPE was not set, default to Release.
+   if (NOT CMAKE_BUILD_TYPE)
+     set(CMAKE_BUILD_TYPE Release)
+@@ -19,7 +21,7 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
+   set(OPENMP_LIBDIR_SUFFIX "" CACHE STRING
+     "Suffix of lib installation directory, e.g. 64 => lib64")
+   # Do not use OPENMP_LIBDIR_SUFFIX directly, use OPENMP_INSTALL_LIBDIR.
+-  set(OPENMP_INSTALL_LIBDIR "lib${OPENMP_LIBDIR_SUFFIX}")
++  set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX}")
+ 
+   # Group test settings.
+   set(OPENMP_TEST_C_COMPILER ${CMAKE_C_COMPILER} CACHE STRING
+@@ -30,7 +32,7 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
+ else()
+   set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
+   # If building in tree, we honor the same install suffix LLVM uses.
+-  set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
++  set(OPENMP_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}${LLVM_LIBDIR_SUFFIX}")
+ 
+   if (NOT MSVC)
+     set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)
+index 0e1ce2afd154..8b3810f83713 100644
+--- a/libomptarget/plugins/amdgpu/CMakeLists.txt
++++ b/libomptarget/plugins/amdgpu/CMakeLists.txt
+@@ -80,7 +80,7 @@ add_library(omptarget.rtl.amdgpu SHARED
+ 
+ # Install plugin under the lib destination folder.
+ # When we build for debug, OPENMP_LIBDIR_SUFFIX get set to -debug
+-install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "lib${OPENMP_LIBDIR_SUFFIX}")
++install(TARGETS omptarget.rtl.amdgpu LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX}")
+ set_property(TARGET omptarget.rtl.amdgpu PROPERTY INSTALL_RPATH_USE_LINK_PATH ON)
+ 
+ if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+diff --git a/libomptarget/plugins/ve/CMakeLists.txt b/libomptarget/plugins/ve/CMakeLists.txt
+index 16ce0891ca23..db30ee9c769f 100644
+--- a/libomptarget/plugins/ve/CMakeLists.txt
++++ b/libomptarget/plugins/ve/CMakeLists.txt
+@@ -32,7 +32,7 @@ if(${LIBOMPTARGET_DEP_VEO_FOUND})
+ 
+   # Install plugin under the lib destination folder.
+   install(TARGETS "omptarget.rtl.${tmachine_libname}"
+-    LIBRARY DESTINATION lib${OPENMP_LIBDIR_SUFFIX})
++    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${OPENMP_LIBDIR_SUFFIX})
+ 
+   target_link_libraries(
+     "omptarget.rtl.${tmachine_libname}"
+diff --git a/runtime/src/CMakeLists.txt b/runtime/src/CMakeLists.txt
+index e4f4e6e1e73f..1164b3b22b0e 100644
+--- a/runtime/src/CMakeLists.txt
++++ b/runtime/src/CMakeLists.txt
+@@ -346,13 +346,13 @@ add_dependencies(libomp-micro-tests libomp-test-deps)
+ # We want to install libomp in DESTDIR/CMAKE_INSTALL_PREFIX/lib
+ # We want to install headers in DESTDIR/CMAKE_INSTALL_PREFIX/include
+ if(${OPENMP_STANDALONE_BUILD})
+-  set(LIBOMP_HEADERS_INSTALL_PATH include)
++  set(LIBOMP_HEADERS_INSTALL_PATH "${CMAKE_INSTALL_INCLUDEDIR}")
+ else()
+   string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
+   set(LIBOMP_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
+ endif()
+ if(WIN32)
+-  install(TARGETS omp RUNTIME DESTINATION bin)
++  install(TARGETS omp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+   install(TARGETS ${LIBOMP_IMP_LIB_TARGET} ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
+   # Create aliases (regular copies) of the library for backwards compatibility
+   set(LIBOMP_ALIASES "libiomp5md")
+diff --git a/tools/multiplex/CMakeLists.txt b/tools/multiplex/CMakeLists.txt
+index 64317c112176..4002784da736 100644
+--- a/tools/multiplex/CMakeLists.txt
++++ b/tools/multiplex/CMakeLists.txt
+@@ -4,7 +4,7 @@ if(LIBOMP_OMPT_SUPPORT)
+   add_library(ompt-multiplex INTERFACE)
+   target_include_directories(ompt-multiplex INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
+ 
+-  install(FILES ompt-multiplex.h DESTINATION include)
++  install(FILES ompt-multiplex.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+ 
+   add_subdirectory(tests)
+ endif()
diff --git a/pkgs/development/compilers/llvm/git/lld/default.nix b/pkgs/development/compilers/llvm/git/lld/default.nix
index cdd2f5f0fa7..fe655c76112 100644
--- a/pkgs/development/compilers/llvm/git/lld/default.nix
+++ b/pkgs/development/compilers/llvm/git/lld/default.nix
@@ -25,9 +25,9 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./gnu-install-dirs.patch
-	# On Darwin the llvm-config is perhaps not working fine as the
-	# LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as
-	# the include path is not correct.
+    # On Darwin the llvm-config is perhaps not working fine as the
+    # LLVM_MAIN_SRC_DIR is not getting set correctly, and the build fails as
+    # the include path is not correct.
     ./fix-root-src-dir.patch
   ];
 
diff --git a/pkgs/development/compilers/purescript/purescript/default.nix b/pkgs/development/compilers/purescript/purescript/default.nix
index 5dd2b6a23b1..cbf36516465 100644
--- a/pkgs/development/compilers/purescript/purescript/default.nix
+++ b/pkgs/development/compilers/purescript/purescript/default.nix
@@ -18,7 +18,7 @@ let
 
 in stdenv.mkDerivation rec {
   pname = "purescript";
-  version = "0.14.6";
+  version = "0.14.7";
 
   # These hashes can be updated automatically by running the ./update.sh script.
   src =
@@ -26,12 +26,12 @@ in stdenv.mkDerivation rec {
     then
     fetchurl {
       url = "https://github.com/${pname}/${pname}/releases/download/v${version}/macos.tar.gz";
-      sha256 = "0yfl4galaqzbbkql2vfsg4zrc5cv037286764kv8qibdk2yrhap3";
+      sha256 = "0pc07xv5h7jgiy04rcrnsjb97nk5zs7jrvcsqggn0izlnrcyi8rc";
     }
     else
     fetchurl {
       url = "https://github.com/${pname}/${pname}/releases/download/v${version}/linux64.tar.gz";
-      sha256 = "01mf850a9jhqba6a3hsbl9fjxp2khplwnlr15wzp637s5vf7rd79";
+      sha256 = "0vcjxb1v76wg4hmisnw0pp6wl0pwp4fa19cw08zdhgy62w06mqfa";
     };
 
 
diff --git a/pkgs/development/libraries/cmark-gfm/default.nix b/pkgs/development/libraries/cmark-gfm/default.nix
index b25688acfa1..7641b6043ef 100644
--- a/pkgs/development/libraries/cmark-gfm/default.nix
+++ b/pkgs/development/libraries/cmark-gfm/default.nix
@@ -14,6 +14,12 @@ stdenv.mkDerivation rec {
   # tests load the library dynamically which for unknown reason failed
   doCheck = false;
 
+  # remove when https://github.com/github/cmark-gfm/pull/248 merged and released
+  postInstall = ''
+    substituteInPlace $out/include/cmark-gfm-core-extensions.h \
+    --replace '#include "config.h"' '#include <stdbool.h>'
+  '';
+
   meta = with lib; {
     description = "GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C";
     homepage = "https://github.com/github/cmark-gfm";
diff --git a/pkgs/development/libraries/libbap/default.nix b/pkgs/development/libraries/libbap/default.nix
index c15de88f6a7..0b378c583ad 100644
--- a/pkgs/development/libraries/libbap/default.nix
+++ b/pkgs/development/libraries/libbap/default.nix
@@ -17,8 +17,8 @@ stdenv.mkDerivation {
       --replace "-linkpkg" "-thread -linkpkg"
   '';
 
-  nativeBuildInputs = [ autoreconfHook which ];
-  buildInputs = [ ocaml bap findlib ctypes ];
+  nativeBuildInputs = [ autoreconfHook which ocaml findlib ];
+  buildInputs = [ bap ctypes ];
 
   preInstall = ''
     mkdir -p $out/lib
diff --git a/pkgs/development/libraries/science/biology/htslib/default.nix b/pkgs/development/libraries/science/biology/htslib/default.nix
index 8a9df7601d2..d93b4fb2a5a 100644
--- a/pkgs/development/libraries/science/biology/htslib/default.nix
+++ b/pkgs/development/libraries/science/biology/htslib/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   pname = "htslib";
-  version = "1.14";
+  version = "1.15";
 
   src = fetchurl {
     url = "https://github.com/samtools/htslib/releases/download/${version}/${pname}-${version}.tar.bz2";
-    sha256 = "sha256-7SIbj1L0gS+BDuvgzFbNg1WlydIcYtFCrAWtDaFHk18=";
+    sha256 = "sha256-Gp9JkRUDoi9WgXzILqm4f7fnRntf+YnKWqYcEufVMtk=";
   };
 
   # perl is only used during the check phase.
diff --git a/pkgs/development/ocaml-modules/apron/default.nix b/pkgs/development/ocaml-modules/apron/default.nix
index c9edfd62e06..9a072482d32 100644
--- a/pkgs/development/ocaml-modules/apron/default.nix
+++ b/pkgs/development/ocaml-modules/apron/default.nix
@@ -10,9 +10,12 @@ stdenv.mkDerivation rec {
     sha256 = "14ymjahqdxj26da8wik9d5dzlxn81b3z1iggdl7rn2nn06jy7lvy";
   };
 
-  buildInputs = [ perl gmp mpfr ppl ocaml findlib camlidl ];
+  nativeBuildInputs = [ ocaml findlib perl ];
+  buildInputs = [ gmp mpfr ppl camlidl ];
   propagatedBuildInputs = [ mlgmpidl ];
 
+  strictDeps = true;
+
   outputs = [ "out" "bin" "dev" ];
 
   configurePhase = ''
diff --git a/pkgs/development/ocaml-modules/astring/default.nix b/pkgs/development/ocaml-modules/astring/default.nix
index 8ecac1c124d..f7478f93b91 100644
--- a/pkgs/development/ocaml-modules/astring/default.nix
+++ b/pkgs/development/ocaml-modules/astring/default.nix
@@ -22,7 +22,10 @@ stdenv.mkDerivation {
     inherit (param) sha256;
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
+
+  strictDeps = true;
 
   inherit (topkg) buildPhase installPhase;
 
diff --git a/pkgs/development/ocaml-modules/atd/default.nix b/pkgs/development/ocaml-modules/atd/default.nix
index de6ade61518..7468900e07e 100644
--- a/pkgs/development/ocaml-modules/atd/default.nix
+++ b/pkgs/development/ocaml-modules/atd/default.nix
@@ -13,9 +13,11 @@ buildDunePackage rec {
     sha256 = "17jm79np69ixp53a4njxnlb1pg8sd1g47nm3nyki9clkc8d4qsyv";
   };
 
-  buildInputs = [ which menhir ];
+  nativeBuildInputs = [ which menhir ];
   propagatedBuildInputs = [ easy-format re ];
 
+  strictDeps = true;
+
   doCheck = true;
 
   passthru.tests = {
diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix
index f8e07fd1265..ea009083e8d 100644
--- a/pkgs/development/ocaml-modules/bap/default.nix
+++ b/pkgs/development/ocaml-modules/bap/default.nix
@@ -36,10 +36,9 @@ stdenv.mkDerivation rec {
     export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH-}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/ocaml${ocaml.version}-bap-${version}-llvm-plugins/"
   '';
 
-  nativeBuildInputs = [ which makeWrapper ];
+  nativeBuildInputs = [ which makeWrapper ocaml findlib ocamlbuild ocaml_oasis ];
 
-  buildInputs = [ ocaml findlib ocamlbuild ocaml_oasis
-                  linenoise
+  buildInputs = [ linenoise
                   ounit
                   ppx_bitstring
                   z3
diff --git a/pkgs/development/ocaml-modules/batteries/default.nix b/pkgs/development/ocaml-modules/batteries/default.nix
index 69e8289df2c..184f10a52be 100644
--- a/pkgs/development/ocaml-modules/batteries/default.nix
+++ b/pkgs/development/ocaml-modules/batteries/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, ocaml, findlib, ocamlbuild, qtest, num
+{ stdenv, lib, fetchFromGitHub, ocaml, findlib, ocamlbuild, qtest, num, ounit
 , doCheck ? lib.versionAtLeast ocaml.version "4.08" && !stdenv.isAarch64
 }:
 
@@ -17,10 +17,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:1cd7475n1mxhq482aidmhh27mq5p2vmb8d9fkb1mlza9pz5z66yq";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
-  checkInputs = [ qtest ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  checkInputs = [ qtest ounit ];
   propagatedBuildInputs = [ num ];
 
+  strictDeps = !doCheck;
+
   inherit doCheck;
   checkTarget = "test";
 
diff --git a/pkgs/development/ocaml-modules/benchmark/default.nix b/pkgs/development/ocaml-modules/benchmark/default.nix
index 3397821319e..c8016230724 100644
--- a/pkgs/development/ocaml-modules/benchmark/default.nix
+++ b/pkgs/development/ocaml-modules/benchmark/default.nix
@@ -9,7 +9,10 @@ stdenv.mkDerivation rec {
     sha256 = "16wi8ld7c3mq77ylpgbnj8qqqqimyzwxs47v06vyrwpma5pab5xa";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ocaml_pcre ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ ocaml_pcre ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/bigarray-overlap/default.nix b/pkgs/development/ocaml-modules/bigarray-overlap/default.nix
index e02b1159a9c..a5f5ae33ede 100644
--- a/pkgs/development/ocaml-modules/bigarray-overlap/default.nix
+++ b/pkgs/development/ocaml-modules/bigarray-overlap/default.nix
@@ -14,9 +14,12 @@ buildDunePackage rec {
   minimumOCamlVersion = "4.07";
   useDune2 = true;
 
+  strictDeps = !doCheck;
+
   propagatedBuildInputs = [ bigarray-compat ];
 
-  checkInputs = [ alcotest astring fpath bos findlib pkg-config ];
+  nativeBuildInputs = [ findlib pkg-config ];
+  checkInputs = [ alcotest astring fpath bos ];
   doCheck = true;
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/bigstringaf/default.nix b/pkgs/development/ocaml-modules/bigstringaf/default.nix
index 852459c2bac..e8d36526d22 100644
--- a/pkgs/development/ocaml-modules/bigstringaf/default.nix
+++ b/pkgs/development/ocaml-modules/bigstringaf/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, buildDunePackage, ocaml, alcotest, bigarray-compat }:
+{ lib, fetchFromGitHub, buildDunePackage, ocaml, alcotest, bigarray-compat, pkg-config }:
 
 buildDunePackage rec {
   pname = "bigstringaf";
@@ -15,6 +15,10 @@ buildDunePackage rec {
     sha256 = "1q1sqxzdnlrpl95ccrhl7lwy3zswgd9rbn19ildclh0lyi2vazbj";
   };
 
+  # This currently fails with dune
+  strictDeps = false;
+
+  nativeBuildInputs = [ pkg-config ];
   checkInputs = [ alcotest ];
   propagatedBuildInputs = [ bigarray-compat ];
   doCheck = lib.versionAtLeast ocaml.version "4.05";
diff --git a/pkgs/development/ocaml-modules/biniou/1.0.nix b/pkgs/development/ocaml-modules/biniou/1.0.nix
index 795e6340129..5a2e2ea9a7f 100644
--- a/pkgs/development/ocaml-modules/biniou/1.0.nix
+++ b/pkgs/development/ocaml-modules/biniou/1.0.nix
@@ -16,7 +16,10 @@ stdenv.mkDerivation rec {
     sha256 = "14j3hrhbjqxbizr1pr8fcig9dmfzhbjjwzwyc99fcsdic67w8izb";
   };
 
-  buildInputs = [ ocaml findlib easy-format ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ easy-format ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/biniou/default.nix b/pkgs/development/ocaml-modules/biniou/default.nix
index 535b34b03dc..75725f13551 100644
--- a/pkgs/development/ocaml-modules/biniou/default.nix
+++ b/pkgs/development/ocaml-modules/biniou/default.nix
@@ -15,6 +15,8 @@ buildDunePackage rec {
 
   propagatedBuildInputs = [ easy-format ];
 
+  strictDeps = true;
+
   postPatch = ''
    patchShebangs .
   '';
diff --git a/pkgs/development/ocaml-modules/bitv/default.nix b/pkgs/development/ocaml-modules/bitv/default.nix
index 2ac3a0ba3e7..07649f3655b 100644
--- a/pkgs/development/ocaml-modules/bitv/default.nix
+++ b/pkgs/development/ocaml-modules/bitv/default.nix
@@ -15,7 +15,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-sZwq6c10hBBS9tGvKlWD9GE3JBrZPByfDrXE6xIPcG4=";
   };
 
-  buildInputs = [ autoreconfHook which ocaml findlib ];
+  nativeBuildInputs = [ autoreconfHook which ocaml findlib ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/bolt/default.nix b/pkgs/development/ocaml-modules/bolt/default.nix
index a6b63676e77..46e3b6f16cc 100644
--- a/pkgs/development/ocaml-modules/bolt/default.nix
+++ b/pkgs/development/ocaml-modules/bolt/default.nix
@@ -18,7 +18,9 @@ stdenv.mkDerivation rec {
     sha256 = "1c807wrpxra9sbb34lajhimwra28ldxv04m570567lh2b04n38zy";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild which camlp4 ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild which camlp4 ];
+
+  strictDeps = true;
 
   patches = [
     (fetchpatch {
diff --git a/pkgs/development/ocaml-modules/bos/default.nix b/pkgs/development/ocaml-modules/bos/default.nix
index 17a0185829e..07d4d4864d8 100644
--- a/pkgs/development/ocaml-modules/bos/default.nix
+++ b/pkgs/development/ocaml-modules/bos/default.nix
@@ -11,10 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "1s10iqx8rgnxr5n93lf4blwirjf8nlm272yg5sipr7lsr35v49wc";
   };
 
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
-  buildInputs = [ findlib topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
   propagatedBuildInputs = [ astring fmt fpath logs rresult ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/bz2/default.nix b/pkgs/development/ocaml-modules/bz2/default.nix
index 617715fc6ed..4ac0262e1ee 100644
--- a/pkgs/development/ocaml-modules/bz2/default.nix
+++ b/pkgs/development/ocaml-modules/bz2/default.nix
@@ -19,9 +19,6 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     autoreconfHook
-  ];
-
-  buildInputs = [
     ocaml
     findlib
   ];
@@ -30,6 +27,8 @@ stdenv.mkDerivation rec {
     bzip2
   ];
 
+  strictDeps = true;
+
   preInstall = "mkdir -p $OCAMLFIND_DESTDIR/stublibs";
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/calendar/default.nix b/pkgs/development/ocaml-modules/calendar/default.nix
index 29927aae04a..4c089b76f3e 100644
--- a/pkgs/development/ocaml-modules/calendar/default.nix
+++ b/pkgs/development/ocaml-modules/calendar/default.nix
@@ -9,7 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "04pvhwb664g3s644c7v7419a3kvf5s3pynkhmk5j59dvlfm1yf0f";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/camlimages/default.nix b/pkgs/development/ocaml-modules/camlimages/default.nix
index ba36cfa05b9..a83c7c474ac 100644
--- a/pkgs/development/ocaml-modules/camlimages/default.nix
+++ b/pkgs/development/ocaml-modules/camlimages/default.nix
@@ -17,7 +17,10 @@ buildDunePackage rec {
     sha256 = "1m2c76ghisg73dikz2ifdkrbkgiwa0hcmp21f2fm2rkbf02rq3f4";
   };
 
-  buildInputs = [ dune-configurator cppo graphics lablgtk stdio ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ cppo ];
+  buildInputs = [ dune-configurator graphics lablgtk stdio ];
 
   meta = with lib; {
     branch = "5.0";
diff --git a/pkgs/development/ocaml-modules/camlpdf/default.nix b/pkgs/development/ocaml-modules/camlpdf/default.nix
index 42c27f15a5b..06456b9c930 100644
--- a/pkgs/development/ocaml-modules/camlpdf/default.nix
+++ b/pkgs/development/ocaml-modules/camlpdf/default.nix
@@ -15,7 +15,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:1qmsa0xgi960y7r20mvf8hxiiml7l1908s4dm7nq262f19w51gsl";
   };
 
-  buildInputs = [ which ocaml findlib ];
+  nativeBuildInputs = [ which ocaml findlib ];
+
+  strictDeps = true;
 
   preInstall = ''
     mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
diff --git a/pkgs/development/ocaml-modules/camlzip/default.nix b/pkgs/development/ocaml-modules/camlzip/default.nix
index c2c2e98b2e0..8124b8d8e43 100644
--- a/pkgs/development/ocaml-modules/camlzip/default.nix
+++ b/pkgs/development/ocaml-modules/camlzip/default.nix
@@ -33,10 +33,12 @@ stdenv.mkDerivation {
     inherit (param) sha256;
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
 
   propagatedBuildInputs = [zlib];
 
+  strictDeps = true;
+
   inherit (param) patches;
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/camomile/0.8.2.nix b/pkgs/development/ocaml-modules/camomile/0.8.2.nix
index 79c7a46e6e9..43bbfe7b6a6 100644
--- a/pkgs/development/ocaml-modules/camomile/0.8.2.nix
+++ b/pkgs/development/ocaml-modules/camomile/0.8.2.nix
@@ -13,7 +13,9 @@ stdenv.mkDerivation rec {
     sha256 = "0x43pjxx70kgip86mmdn08s97k4qzdqc8i79xfyyx28smy1bsa00";
   };
 
-  buildInputs = [ocaml findlib camlp4];
+  nativeBuildInputs = [ ocaml findlib camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/camomile/0.8.5.nix b/pkgs/development/ocaml-modules/camomile/0.8.5.nix
index 67bd8b8c755..e6395383698 100644
--- a/pkgs/development/ocaml-modules/camomile/0.8.5.nix
+++ b/pkgs/development/ocaml-modules/camomile/0.8.5.nix
@@ -14,7 +14,9 @@ stdenv.mkDerivation {
     sha256 = "167279lia6qx62mdcyc5rjsi4gf4yi52wn9mhgd9y1v3754z7fwb";
   })];
 
-  buildInputs = [ocaml findlib camlp4];
+  nativeBuildInputs = [ocaml findlib camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/camomile/default.nix b/pkgs/development/ocaml-modules/camomile/default.nix
index 090b96ece0c..a75f05b33f2 100644
--- a/pkgs/development/ocaml-modules/camomile/default.nix
+++ b/pkgs/development/ocaml-modules/camomile/default.nix
@@ -13,7 +13,9 @@ buildDunePackage rec {
     sha256 = "00i910qjv6bpk0nkafp5fg97isqas0bwjf7m6rz11rsxilpalzad";
   };
 
-  buildInputs = [ cppo ];
+  nativeBuildInputs = [ cppo ];
+
+  strictDeps = true;
 
   configurePhase = ''
     runHook preConfigure
diff --git a/pkgs/development/ocaml-modules/caqti/default.nix b/pkgs/development/ocaml-modules/caqti/default.nix
index 105a6a9dfe1..d9606cda1fa 100644
--- a/pkgs/development/ocaml-modules/caqti/default.nix
+++ b/pkgs/development/ocaml-modules/caqti/default.nix
@@ -14,7 +14,7 @@ buildDunePackage rec {
     sha256 = "1vl61kdyj89whc3mh4k9bis6rbj9x2scf6hnv9afyalp4j65sqx1";
   };
 
-  buildInputs = [ cppo ];
+  nativeBuildInputs = [ cppo ];
   propagatedBuildInputs = [ logs ptime uri ];
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/carton/default.nix b/pkgs/development/ocaml-modules/carton/default.nix
index 97e00dc71b6..6868ddc7851 100644
--- a/pkgs/development/ocaml-modules/carton/default.nix
+++ b/pkgs/development/ocaml-modules/carton/default.nix
@@ -48,13 +48,15 @@ buildDunePackage rec {
   ];
 
   doCheck = true;
+  nativeBuildInputs = [
+    findlib
+  ];
   checkInputs = [
     base64
     alcotest
     alcotest-lwt
     crowbar
     lwt
-    findlib
     mirage-flow
   ];
 
diff --git a/pkgs/development/ocaml-modules/cfstream/default.nix b/pkgs/development/ocaml-modules/cfstream/default.nix
index 303fdc01011..62a29a5d414 100644
--- a/pkgs/development/ocaml-modules/cfstream/default.nix
+++ b/pkgs/development/ocaml-modules/cfstream/default.nix
@@ -17,7 +17,10 @@ buildDunePackage rec {
 
   patches = [ ./git_commit.patch ];
 
-  buildInputs = [ m4 ];
+  # This currently fails with dune
+  strictDeps = false;
+
+  nativeBuildInputs = [ m4 ];
   checkInputs = [ ounit ];
   propagatedBuildInputs = [ core_kernel ];
 
diff --git a/pkgs/development/ocaml-modules/checkseum/default.nix b/pkgs/development/ocaml-modules/checkseum/default.nix
index 3483af1dd41..3a07707a4cd 100644
--- a/pkgs/development/ocaml-modules/checkseum/default.nix
+++ b/pkgs/development/ocaml-modules/checkseum/default.nix
@@ -18,10 +18,8 @@ buildDunePackage rec {
     sha256 = "9cdd282ea1cfc424095d7284e39e4d0ad091de3c3f2580539d03f6966d45ccd5";
   };
 
-  nativeBuildInputs = [
-    dune-configurator
-    pkg-config
-  ];
+  buildInputs = [ dune-configurator ];
+  nativeBuildInputs = [ pkg-config ];
   propagatedBuildInputs = [
     bigarray-compat
     optint
diff --git a/pkgs/development/ocaml-modules/cil/default.nix b/pkgs/development/ocaml-modules/cil/default.nix
index c5a3dcde226..7a8a3f2e70a 100644
--- a/pkgs/development/ocaml-modules/cil/default.nix
+++ b/pkgs/development/ocaml-modules/cil/default.nix
@@ -13,7 +13,9 @@ stdenv.mkDerivation rec {
     sha256 = "05739da0b0msx6kmdavr3y2bwi92jbh3szc35d7d8pdisa8g5dv9";
   };
 
-  buildInputs = [ perl ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ perl ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/cmdliner/default.nix b/pkgs/development/ocaml-modules/cmdliner/default.nix
index 7e49679406a..9536cc25290 100644
--- a/pkgs/development/ocaml-modules/cmdliner/default.nix
+++ b/pkgs/development/ocaml-modules/cmdliner/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     inherit (param) sha256;
   };
 
-  nativeBuildInputs = [ ocaml ocamlbuild findlib ];
+  nativeBuildInputs = [ ocaml ocamlbuild findlib topkg ];
   buildInputs = [ topkg ];
   propagatedBuildInputs = [ result ];
 
diff --git a/pkgs/development/ocaml-modules/coin/default.nix b/pkgs/development/ocaml-modules/coin/default.nix
index f0697a9d880..f2e0919bdee 100644
--- a/pkgs/development/ocaml-modules/coin/default.nix
+++ b/pkgs/development/ocaml-modules/coin/default.nix
@@ -24,9 +24,11 @@ buildDunePackage rec {
 
   useDune2 = true;
 
-  nativeBuildInputs = [ menhir ];
+  nativeBuildInputs = [ menhir findlib ];
+  buildInputs = [ re ];
+
+  strictDeps = true;
 
-  checkInputs = [ re ];
   doCheck = true;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/comparelib/default.nix b/pkgs/development/ocaml-modules/comparelib/default.nix
index 1d7c314f005..1da631d683c 100644
--- a/pkgs/development/ocaml-modules/comparelib/default.nix
+++ b/pkgs/development/ocaml-modules/comparelib/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildOcaml, fetchFromGitHub, type_conv }:
+{ lib, buildOcaml, fetchFromGitHub, type_conv, camlp4 }:
 
 buildOcaml rec {
   pname = "comparelib";
@@ -13,6 +13,7 @@ buildOcaml rec {
     sha256 = "sha256-gtJvXAUxiIt/L9bCzS+8wHcCQ+QpBubwcjDcyN0K2MA=";
   };
 
+  buildInputs = [ camlp4 ];
   propagatedBuildInputs = [ type_conv ];
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/config-file/default.nix b/pkgs/development/ocaml-modules/config-file/default.nix
index c408d1a392f..b9dde0e6425 100644
--- a/pkgs/development/ocaml-modules/config-file/default.nix
+++ b/pkgs/development/ocaml-modules/config-file/default.nix
@@ -9,7 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "1b02yxcnsjhr05ssh2br2ka4hxsjpdw34ldl3nk33wfnkwk7g67q";
   };
 
-  buildInputs = [ ocaml findlib camlp4 ];
+  nativeBuildInputs = [ ocaml findlib camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/cpdf/default.nix b/pkgs/development/ocaml-modules/cpdf/default.nix
index 632430fe4f7..3f60263736e 100644
--- a/pkgs/development/ocaml-modules/cpdf/default.nix
+++ b/pkgs/development/ocaml-modules/cpdf/default.nix
@@ -15,9 +15,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:1qmx229nij7g6qmiacmyy4mcgx3k9509p4slahivshqm79d6wiwl";
   };
 
-  buildInputs = [ ocaml findlib ncurses ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ ncurses ];
   propagatedBuildInputs = [ camlpdf ];
 
+  strictDeps = true;
+
   preInstall = ''
     mkdir -p $OCAMLFIND_DESTDIR
     mkdir -p $out/bin
diff --git a/pkgs/development/ocaml-modules/cryptgps/default.nix b/pkgs/development/ocaml-modules/cryptgps/default.nix
index 6011c6953ba..aeaa87aaf75 100644
--- a/pkgs/development/ocaml-modules/cryptgps/default.nix
+++ b/pkgs/development/ocaml-modules/cryptgps/default.nix
@@ -13,7 +13,9 @@ stdenv.mkDerivation {
     sha256 = "1mp7i42cm9w9grmcsa69m3h1ycpn6a48p43y4xj8rsc12x9nav3s";
   };
 
-  buildInputs = [ocaml findlib];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   dontConfigure = true;	# Skip configure phase
 
diff --git a/pkgs/development/ocaml-modules/csv/1.5.nix b/pkgs/development/ocaml-modules/csv/1.5.nix
index ee68782313c..cd298fb39a9 100644
--- a/pkgs/development/ocaml-modules/csv/1.5.nix
+++ b/pkgs/development/ocaml-modules/csv/1.5.nix
@@ -9,7 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "1ca7jgg58j24pccs5fshis726s06fdcjshnwza5kwxpjgdbvc63g";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/ctypes/default.nix b/pkgs/development/ocaml-modules/ctypes/default.nix
index 8c20a68c274..833ea45a869 100644
--- a/pkgs/development/ocaml-modules/ctypes/default.nix
+++ b/pkgs/development/ocaml-modules/ctypes/default.nix
@@ -15,10 +15,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-eu5RAuPYC97IM4XUsUw3HQ1BJlEHQ+eBpsdUE6hd+Q8=";
   };
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml findlib ncurses ];
+  nativeBuildInputs = [ pkg-config ocaml findlib ];
+  buildInputs = [ ncurses ];
   propagatedBuildInputs = [ integers libffi bigarray-compat ];
 
+  strictDeps = true;
+
   buildPhase = ''
     make XEN=false libffi.config ctypes-base ctypes-stubs
     make XEN=false ctypes-foreign
diff --git a/pkgs/development/ocaml-modules/digestif/default.nix b/pkgs/development/ocaml-modules/digestif/default.nix
index 2ddaec5c7c1..dba0bcb9269 100644
--- a/pkgs/development/ocaml-modules/digestif/default.nix
+++ b/pkgs/development/ocaml-modules/digestif/default.nix
@@ -1,4 +1,5 @@
 { lib, ocaml, fetchurl, buildDunePackage
+, pkg-config, which
 , bigarray-compat, eqaf, stdlib-shims
 , alcotest, astring, bos, findlib, fpath
 }:
@@ -14,8 +15,13 @@ buildDunePackage rec {
     sha256 = "01gwkbrznci4xdcbww4ysgsciz2qs0r8jsmhp0siwbcgcrf1jjv5";
   };
 
+  nativeBuildInputs = [ findlib which ];
+  buildInputs = [ ocaml ];
+
   propagatedBuildInputs = [ bigarray-compat eqaf stdlib-shims ];
 
+  strictDeps = !doCheck;
+
   checkInputs = [ alcotest astring bos fpath ];
   doCheck = lib.versionAtLeast ocaml.version "4.05";
 
diff --git a/pkgs/development/ocaml-modules/dolmen/default.nix b/pkgs/development/ocaml-modules/dolmen/default.nix
index 9a21da98681..7a7a14192f9 100644
--- a/pkgs/development/ocaml-modules/dolmen/default.nix
+++ b/pkgs/development/ocaml-modules/dolmen/default.nix
@@ -16,7 +16,9 @@ buildDunePackage rec {
     sha256 = "133l23mwxa9xy340izvk4zp5jqjz2cwsm2innsgs2kg85pd39c41";
   };
 
-  buildInputs = [ menhir ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ menhir ];
   propagatedBuildInputs = [ menhirLib fmt ];
 
   # Testr are not compatible with menhir 20211128
diff --git a/pkgs/development/ocaml-modules/dolog/default.nix b/pkgs/development/ocaml-modules/dolog/default.nix
index 64fb2b2c5a5..599cc356031 100644
--- a/pkgs/development/ocaml-modules/dolog/default.nix
+++ b/pkgs/development/ocaml-modules/dolog/default.nix
@@ -11,7 +11,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-6wfqT5sqo4YA8XoHH3QhG6/TyzzXCzqjmnPuBArRoj8=";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/dum/default.nix b/pkgs/development/ocaml-modules/dum/default.nix
index 7bdaf2dfad9..3faef36e8ec 100644
--- a/pkgs/development/ocaml-modules/dum/default.nix
+++ b/pkgs/development/ocaml-modules/dum/default.nix
@@ -13,9 +13,11 @@ stdenv.mkDerivation rec {
     sha256 = "0yrxl97szjc0s2ghngs346x3y0xszx2chidgzxk93frjjpsr1mlr";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
   propagatedBuildInputs = [ easy-format ];
 
+  strictDeps = true;
+
   createFindlibDestdir = true;
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/dypgen/default.nix b/pkgs/development/ocaml-modules/dypgen/default.nix
index 5b5b107b694..64017bd65fe 100644
--- a/pkgs/development/ocaml-modules/dypgen/default.nix
+++ b/pkgs/development/ocaml-modules/dypgen/default.nix
@@ -17,7 +17,9 @@ stdenv.mkDerivation rec {
     sha256 = "ecb53d6e469e9ec4d57ee6323ff498d45b78883ae13618492488e7c5151fdd97";
   };
 
-  buildInputs = [ocaml findlib];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/elina/default.nix b/pkgs/development/ocaml-modules/elina/default.nix
index 2ddef0f4052..df7f140e545 100644
--- a/pkgs/development/ocaml-modules/elina/default.nix
+++ b/pkgs/development/ocaml-modules/elina/default.nix
@@ -8,10 +8,12 @@ stdenv.mkDerivation rec {
     sha256 = "1nymykskq1yx87y4xl6hl9i4q6kv0qaq25rniqgl1bfn883p1ysc";
   };
 
-  buildInputs = [ perl ocaml findlib ];
+  nativeBuildInputs = [ perl ocaml findlib ];
 
   propagatedBuildInputs = [ apron camlidl gmp mpfr ];
 
+  strictDeps = true;
+
   prefixKey = "--prefix ";
   configureFlags = [
     "--use-apron"
diff --git a/pkgs/development/ocaml-modules/eliom/default.nix b/pkgs/development/ocaml-modules/eliom/default.nix
index 69ac628d201..e3af173edc9 100644
--- a/pkgs/development/ocaml-modules/eliom/default.nix
+++ b/pkgs/development/ocaml-modules/eliom/default.nix
@@ -6,6 +6,7 @@
 , ocaml
 , lwt_react
 , opaline
+, ocamlbuild
 , ppx_deriving
 , findlib
 , js_of_ocaml-ocamlbuild
@@ -28,13 +29,16 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-VNxzpVpXEGlixyjadbW0GjL83jcKV5TWd46UReNYO6w=";
   };
 
-  buildInputs = [
+  nativeBuildInputs = [
     ocaml
     which
     findlib
+    opaline
+    ocamlbuild
+  ];
+  buildInputs = [
     js_of_ocaml-ocamlbuild
     js_of_ocaml-ppx_deriving_json
-    opaline
     ocamlnet
   ];
 
@@ -48,6 +52,8 @@ stdenv.mkDerivation rec {
     ppx_deriving
   ];
 
+  strictDeps = true;
+
   installPhase = "opaline -prefix $out -libdir $OCAMLFIND_DESTDIR";
 
   setupHook = [ ./setup-hook.sh ];
diff --git a/pkgs/development/ocaml-modules/enumerate/default.nix b/pkgs/development/ocaml-modules/enumerate/default.nix
index d7f467e8eb9..9bedc421510 100644
--- a/pkgs/development/ocaml-modules/enumerate/default.nix
+++ b/pkgs/development/ocaml-modules/enumerate/default.nix
@@ -15,9 +15,11 @@ stdenv.mkDerivation rec {
     sha256 = "0b6mx5p01lcpimvak4wx6aj2119707wsfzd83rwgb91bhpgzh156";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
   propagatedBuildInputs = [ type_conv camlp4 ];
 
+  strictDeps = true;
+
   createFindlibDestdir = true;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/erm_xml/default.nix b/pkgs/development/ocaml-modules/erm_xml/default.nix
index fa072f8bd1c..ebf9cdaad69 100644
--- a/pkgs/development/ocaml-modules/erm_xml/default.nix
+++ b/pkgs/development/ocaml-modules/erm_xml/default.nix
@@ -15,7 +15,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-OQdLTq9tJZc6XlcuPv2gxzYiQAUGd6AiBzfSi169XL0=";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/erm_xmpp/default.nix b/pkgs/development/ocaml-modules/erm_xmpp/default.nix
index 3447d590ea2..1507154d2f6 100644
--- a/pkgs/development/ocaml-modules/erm_xmpp/default.nix
+++ b/pkgs/development/ocaml-modules/erm_xmpp/default.nix
@@ -13,9 +13,12 @@ stdenv.mkDerivation rec {
     sha256 = "0spzyd9kbyizzwl8y3mq8z19zlkzxnkh2fppry4lyc7vaw7bqrwq";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild camlp4 ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild camlp4 ];
+  buildInputs = [ camlp4 ];
   propagatedBuildInputs = [ erm_xml mirage-crypto mirage-crypto-rng base64 ];
 
+  strictDeps = true;
+
   configurePhase = ''
     runHook preConfigure
     ocaml setup.ml -configure --prefix $out
diff --git a/pkgs/development/ocaml-modules/expat/0.9.nix b/pkgs/development/ocaml-modules/expat/0.9.nix
index 219b8164e7c..326ffc60b1a 100644
--- a/pkgs/development/ocaml-modules/expat/0.9.nix
+++ b/pkgs/development/ocaml-modules/expat/0.9.nix
@@ -18,7 +18,10 @@ stdenv.mkDerivation rec {
     sha256 = "16n2j3y0jc9xgqyshw9plrwqnjiz30vnpbhahmgxlidbycw8rgjz";
   };
 
-  buildInputs = [ocaml findlib ounit expat];
+  nativeBuildInputs = [ocaml findlib ];
+  buildInputs = [ ounit expat];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/expat/default.nix b/pkgs/development/ocaml-modules/expat/default.nix
index e951acaa71a..6fb7927073d 100644
--- a/pkgs/development/ocaml-modules/expat/default.nix
+++ b/pkgs/development/ocaml-modules/expat/default.nix
@@ -15,7 +15,10 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace "gcc" "\$(CC)"
   '';
 
-  buildInputs = [ ocaml findlib expat ounit ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ expat ounit ];
+
+  strictDeps = true;
 
   doCheck = !lib.versionAtLeast ocaml.version "4.06";
   checkTarget = "testall";
diff --git a/pkgs/development/ocaml-modules/extlib/default.nix b/pkgs/development/ocaml-modules/extlib/default.nix
index d1860788838..7f50548f4b8 100644
--- a/pkgs/development/ocaml-modules/extlib/default.nix
+++ b/pkgs/development/ocaml-modules/extlib/default.nix
@@ -12,7 +12,9 @@ stdenv.mkDerivation rec {
     sha256 = "0npq4hq3zym8nmlyji7l5cqk6drx2rkcx73d60rxqh5g8dla8p4k";
   };
 
-  buildInputs = [ ocaml findlib cppo ];
+  nativeBuildInputs = [ ocaml findlib cppo ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/farfadet/default.nix b/pkgs/development/ocaml-modules/farfadet/default.nix
index 79b742da575..1ac5595a015 100644
--- a/pkgs/development/ocaml-modules/farfadet/default.nix
+++ b/pkgs/development/ocaml-modules/farfadet/default.nix
@@ -15,10 +15,13 @@ stdenv.mkDerivation rec {
     sha256 = "0nlafnp0pwx0n4aszpsk6nvcvqi9im306p4jhx70si7k3xprlr2j";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
 
   propagatedBuildInputs = [ faraday ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/fmt/default.nix b/pkgs/development/ocaml-modules/fmt/default.nix
index a66976b4a2b..edf8d08eaab 100644
--- a/pkgs/development/ocaml-modules/fmt/default.nix
+++ b/pkgs/development/ocaml-modules/fmt/default.nix
@@ -13,9 +13,11 @@ stdenv.mkDerivation rec {
     sha256 = "0gkkkj4x678vxdda4xaw2dd44qjacavsvn5nx8gydfwah6pjbkxk";
   };
 
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
-  buildInputs = [ findlib topkg cmdliner ];
-  propagatedBuildInputs = [ seq stdlib-shims ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
+  propagatedBuildInputs = [ cmdliner seq stdlib-shims ];
+
+  strictDeps = true;
 
   inherit (topkg) buildPhase installPhase;
 
diff --git a/pkgs/development/ocaml-modules/fontconfig/default.nix b/pkgs/development/ocaml-modules/fontconfig/default.nix
index f4afe80d532..2eca9a4644b 100644
--- a/pkgs/development/ocaml-modules/fontconfig/default.nix
+++ b/pkgs/development/ocaml-modules/fontconfig/default.nix
@@ -11,8 +11,11 @@ stdenv.mkDerivation {
     sha256 = "1fw6bzydmnyh2g4x35mcbg0hypnxqhynivk4nakcsx7prr8zr3yh";
   };
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml fontconfig ];
+  nativeBuildInputs = [ pkg-config ocaml ];
+  buildInputs = [ fontconfig ];
+
+  strictDeps = true;
+
   makeFlags = [
     "OCAML_STDLIB_DIR=$(out)/lib/ocaml/${lib.getVersion ocaml}/site-lib/"
     "OCAML_HAVE_OCAMLOPT=yes"
diff --git a/pkgs/development/ocaml-modules/fpath/default.nix b/pkgs/development/ocaml-modules/fpath/default.nix
index 532210888bf..53489f69cc3 100644
--- a/pkgs/development/ocaml-modules/fpath/default.nix
+++ b/pkgs/development/ocaml-modules/fpath/default.nix
@@ -13,10 +13,13 @@ stdenv.mkDerivation rec {
     sha256 = "03z7mj0sqdz465rc4drj1gr88l9q3nfs374yssvdjdyhjbqqzc0j";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
 
   propagatedBuildInputs = [ astring ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/frontc/default.nix b/pkgs/development/ocaml-modules/frontc/default.nix
index bc74a5b58a0..c05422497ee 100644
--- a/pkgs/development/ocaml-modules/frontc/default.nix
+++ b/pkgs/development/ocaml-modules/frontc/default.nix
@@ -18,7 +18,9 @@ stdenv.mkDerivation rec {
     sha256 = "1dq5nks0c9gsbr1m8k39m1bniawr5hqcy1r8x5px7naa95ch06ak";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   meta = with lib; {
     inherit (src.meta) homepage;
diff --git a/pkgs/development/ocaml-modules/functory/default.nix b/pkgs/development/ocaml-modules/functory/default.nix
index 959963c4752..a05472366a2 100644
--- a/pkgs/development/ocaml-modules/functory/default.nix
+++ b/pkgs/development/ocaml-modules/functory/default.nix
@@ -21,7 +21,9 @@ stdenv.mkDerivation {
     inherit (param) sha256;
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   installTargets = [ "ocamlfind-install" ];
 
diff --git a/pkgs/development/ocaml-modules/getopt/default.nix b/pkgs/development/ocaml-modules/getopt/default.nix
index 3400774d4c0..e3bf2fb5d64 100644
--- a/pkgs/development/ocaml-modules/getopt/default.nix
+++ b/pkgs/development/ocaml-modules/getopt/default.nix
@@ -9,12 +9,14 @@ stdenv.mkDerivation rec {
     sha256 = "0bng2mmdixpmj23xn8krlnaq66k22iclwz46r8zjrsrq3wcn1xgn";
   };
 
-  buildInputs = [
+  nativeBuildInputs = [
     ocaml
     findlib
     ocamlbuild
   ];
 
+  strictDeps = true;
+
   doCheck = true;
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/gg/default.nix b/pkgs/development/ocaml-modules/gg/default.nix
index fb192077690..ec8bbb31617 100644
--- a/pkgs/development/ocaml-modules/gg/default.nix
+++ b/pkgs/development/ocaml-modules/gg/default.nix
@@ -18,7 +18,8 @@ stdenv.mkDerivation {
     sha256 = "sha256:0j7bpj8k17csnz6v6frkz9aycywsb7xmznnb31g8rbfk3626f3ci";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
 
   inherit (topkg) buildPhase installPhase;
 
diff --git a/pkgs/development/ocaml-modules/gmetadom/default.nix b/pkgs/development/ocaml-modules/gmetadom/default.nix
index 29df5ce8f4e..50be2adcb38 100644
--- a/pkgs/development/ocaml-modules/gmetadom/default.nix
+++ b/pkgs/development/ocaml-modules/gmetadom/default.nix
@@ -21,11 +21,12 @@ stdenv.mkDerivation rec {
     configureFlags="--with-ocaml-lib-prefix=$out/lib/ocaml/${ocaml.version}/site-lib"
   '';
 
-
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ocaml findlib gdome2 libxslt];
+  nativeBuildInputs = [ pkg-config ocaml findlib ];
+  buildInputs = [ gdome2 libxslt];
   propagatedBuildInputs = [gdome2];
 
+  strictDeps = true;
+
   meta = {
     homepage = "http://gmetadom.sourceforge.net/";
     description = "A collection of librares, each library providing a DOM implementation";
diff --git a/pkgs/development/ocaml-modules/hacl-star/default.nix b/pkgs/development/ocaml-modules/hacl-star/default.nix
index 8a29439c7a5..004aa5c9a44 100644
--- a/pkgs/development/ocaml-modules/hacl-star/default.nix
+++ b/pkgs/development/ocaml-modules/hacl-star/default.nix
@@ -12,7 +12,9 @@ buildDunePackage {
     zarith
   ];
 
-  buildInputs = [
+  nativeBuildInputs = [
     cppo
   ];
+
+  strictDeps = true;
 }
diff --git a/pkgs/development/ocaml-modules/hacl-star/raw.nix b/pkgs/development/ocaml-modules/hacl-star/raw.nix
index c7852338253..58fa1eb0021 100644
--- a/pkgs/development/ocaml-modules/hacl-star/raw.nix
+++ b/pkgs/development/ocaml-modules/hacl-star/raw.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   dontAddStaticConfigureFlags = true;
   configurePlatforms = [];
 
-  buildInputs = [
+  nativeBuildInputs = [
     which
     ocaml
     findlib
@@ -42,6 +42,8 @@ stdenv.mkDerivation rec {
     cppo
   ];
 
+  strictDeps = true;
+
   doCheck = true;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/herelib/default.nix b/pkgs/development/ocaml-modules/herelib/default.nix
index 14c775d25fc..f9267ede60a 100644
--- a/pkgs/development/ocaml-modules/herelib/default.nix
+++ b/pkgs/development/ocaml-modules/herelib/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildOcaml, fetchFromGitHub }:
+{ lib, buildOcaml, fetchFromGitHub, camlp4 }:
 
 buildOcaml rec {
   version = "112.35.00";
@@ -13,6 +13,10 @@ buildOcaml rec {
     sha256 = "sha256-EuMhHu2na3lcpsJ1wMVOgBr6VKndlonq8jgAW01eelI=";
   };
 
+  strictDeps = true;
+
+  buildInputs = [ camlp4 ];
+
   meta = with lib; {
     homepage = "https://github.com/janestreet/herelib";
     description = "Syntax extension for inserting the current location";
diff --git a/pkgs/development/ocaml-modules/hidapi/default.nix b/pkgs/development/ocaml-modules/hidapi/default.nix
index 2caa25654e3..44b1d5f150a 100644
--- a/pkgs/development/ocaml-modules/hidapi/default.nix
+++ b/pkgs/development/ocaml-modules/hidapi/default.nix
@@ -13,9 +13,12 @@ buildDunePackage rec {
     sha256 = "1j7rd7ajrzla76r3sxljx6fb18f4f4s3jd7vhv59l2ilxyxycai2";
   };
 
+  strictDeps = true;
+
   minimumOCamlVersion = "4.03";
 
-  buildInputs = [ pkgs.hidapi pkg-config dune-configurator ];
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ pkgs.hidapi dune-configurator ];
   propagatedBuildInputs = [ bigstring ];
 
   doCheck = true;
diff --git a/pkgs/development/ocaml-modules/hmap/default.nix b/pkgs/development/ocaml-modules/hmap/default.nix
index 67622a8ef6a..d0ae47031b2 100644
--- a/pkgs/development/ocaml-modules/hmap/default.nix
+++ b/pkgs/development/ocaml-modules/hmap/default.nix
@@ -22,7 +22,10 @@ stdenv.mkDerivation rec {
     sha256 = "10xyjy4ab87z7jnghy0wnla9wrmazgyhdwhr4hdmxxdn28dxn03a";
   };
 
-  buildInputs = [ ocaml ocamlbuild findlib topkg ];
+  nativeBuildInputs = [ ocaml ocamlbuild findlib topkg ];
+  buildInputs = [ topkg ];
+
+  strictDeps = true;
 
   inherit (topkg) installPhase;
 
diff --git a/pkgs/development/ocaml-modules/hxd/default.nix b/pkgs/development/ocaml-modules/hxd/default.nix
index 0775e21b1f8..0b05a83dd7e 100644
--- a/pkgs/development/ocaml-modules/hxd/default.nix
+++ b/pkgs/development/ocaml-modules/hxd/default.nix
@@ -21,14 +21,11 @@ buildDunePackage rec {
     sed -i 's|yes ".\+"|& 2> /dev/null|' test/*.t
   '';
 
-  nativeBuildInputs = [
-    dune-configurator
-  ];
-
   propagatedBuildInputs = lib.optional withLwt lwt;
 
   buildInputs = [
     cmdliner
+    dune-configurator
   ];
 
   doCheck = true;
diff --git a/pkgs/development/ocaml-modules/inifiles/default.nix b/pkgs/development/ocaml-modules/inifiles/default.nix
index 90308ee7d6d..cbeae7bca83 100644
--- a/pkgs/development/ocaml-modules/inifiles/default.nix
+++ b/pkgs/development/ocaml-modules/inifiles/default.nix
@@ -16,9 +16,11 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
   propagatedBuildInputs = [ ocaml_pcre ];
 
+  strictDeps = true;
+
   buildFlags = [ "all" "opt" ];
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/inotify/default.nix b/pkgs/development/ocaml-modules/inotify/default.nix
index e8289d92963..d1c6dc37616 100644
--- a/pkgs/development/ocaml-modules/inotify/default.nix
+++ b/pkgs/development/ocaml-modules/inotify/default.nix
@@ -19,9 +19,13 @@ stdenv.mkDerivation rec {
     sha256 = "04lfxrrsmk2mc704kaln8jqx93jc4bkxhijmfy2d4cmk1cim7r6k";
   }) ];
 
-  buildInputs = [ ocaml findlib ocamlbuild ocaml_lwt ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ ocaml_lwt ];
   checkInputs = [ ounit fileutils ];
 
+  # Otherwise checkInputs can't be found
+  strictDeps = false;
+
   configureFlags = [ "--enable-lwt"
     (lib.optionalString doCheck "--enable-tests") ];
 
diff --git a/pkgs/development/ocaml-modules/iso8601/default.nix b/pkgs/development/ocaml-modules/iso8601/default.nix
index add18281008..ff9ce94bbbd 100644
--- a/pkgs/development/ocaml-modules/iso8601/default.nix
+++ b/pkgs/development/ocaml-modules/iso8601/default.nix
@@ -11,7 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-sXnYAJcU88797orzzfbA2XG91Lk8mDV677J1Am5o7Xo=";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
+
   createFindlibDestdir = true;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/janestreet/0.12.nix b/pkgs/development/ocaml-modules/janestreet/0.12.nix
index 10d8886d994..ec2f793caf9 100644
--- a/pkgs/development/ocaml-modules/janestreet/0.12.nix
+++ b/pkgs/development/ocaml-modules/janestreet/0.12.nix
@@ -24,6 +24,7 @@ with self;
     hash = "0gl89zpgsf3n30nb6v5cns27g2bfg4rf3s2427gqvwbkr5gcf7ri";
     meta.description = "Full standard library replacement for OCaml";
     propagatedBuildInputs = [ sexplib0 ];
+    buildInputs = [ dune-configurator ];
   };
 
   stdio = janePackage {
diff --git a/pkgs/development/ocaml-modules/janestreet/0.14.nix b/pkgs/development/ocaml-modules/janestreet/0.14.nix
index d22a87a92f3..7d1c8544709 100644
--- a/pkgs/development/ocaml-modules/janestreet/0.14.nix
+++ b/pkgs/development/ocaml-modules/janestreet/0.14.nix
@@ -203,6 +203,8 @@ with self;
     meta.description = "Trivial metaprogramming tool";
     propagatedBuildInputs = [ re ];
     checkInputs = [ ppx_jane ];
+    # This currently fails with dune
+    strictDeps = false;
   };
 
   core = janePackage {
@@ -761,6 +763,8 @@ with self;
     buildInputs = [ jst-config ];
     propagatedBuildInputs = [ textutils ];
     checkInputs = [ ounit ];
+    # This currently fails with dune
+    strictDeps = false;
   };
 
   shexp = janePackage {
diff --git a/pkgs/development/ocaml-modules/janestreet/janePackage.nix b/pkgs/development/ocaml-modules/janestreet/janePackage.nix
index 9a67db4966c..63c4a900fce 100644
--- a/pkgs/development/ocaml-modules/janestreet/janePackage.nix
+++ b/pkgs/development/ocaml-modules/janestreet/janePackage.nix
@@ -1,9 +1,9 @@
 { lib, fetchFromGitHub, buildDunePackage, defaultVersion ? "0.11.0" }:
 
-{ pname, version ? defaultVersion, hash, ...}@args:
+{ pname, version ? defaultVersion, hash, buildInputs ? [], ...}@args:
 
 buildDunePackage (args // {
-  inherit version;
+  inherit version buildInputs;
 
   minimumOCamlVersion = "4.04";
 
@@ -14,6 +14,8 @@ buildDunePackage (args // {
     sha256 = hash;
   };
 
+  strictDeps = true;
+
   meta = {
     license = lib.licenses.asl20;
     homepage = "https://github.com/janestreet/${pname}";
diff --git a/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix b/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix
index 6c7d746e948..ebde7b240ef 100644
--- a/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix
+++ b/pkgs/development/ocaml-modules/janestreet/janePackage_0_12.nix
@@ -1,12 +1,14 @@
 { lib, fetchFromGitHub, buildDunePackage, defaultVersion ? "0.12.0" }:
 
-{ pname, version ? defaultVersion, hash, ...}@args:
+{ pname, version ? defaultVersion, hash, buildInputs ? [], ...}@args:
 
 buildDunePackage (args // {
-  inherit version;
+  inherit version buildInputs;
 
   minimumOCamlVersion = "4.07";
 
+  useDune2 = true;
+
   src = fetchFromGitHub {
     owner = "janestreet";
     repo = pname;
@@ -14,6 +16,8 @@ buildDunePackage (args // {
     sha256 = hash;
   };
 
+  strictDeps = true;
+
   meta = {
     license = lib.licenses.mit;
     homepage = "https://github.com/janestreet/${pname}";
diff --git a/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix b/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix
index 1ed2e6bc4f2..d124baea897 100644
--- a/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix
+++ b/pkgs/development/ocaml-modules/janestreet/janePackage_0_14.nix
@@ -5,11 +5,13 @@
 , hash
 , minimumOCamlVersion ? "4.08"
 , doCheck ? true
+, buildInputs ? []
+, strictDeps ? true
 , ...}@args:
 
 buildDunePackage (args // {
   useDune2 = true;
-  inherit version;
+  inherit version buildInputs strictDeps;
 
   inherit minimumOCamlVersion;
 
diff --git a/pkgs/development/ocaml-modules/javalib/default.nix b/pkgs/development/ocaml-modules/javalib/default.nix
index 78b61de8d9c..ccd3fa19a92 100644
--- a/pkgs/development/ocaml-modules/javalib/default.nix
+++ b/pkgs/development/ocaml-modules/javalib/default.nix
@@ -23,7 +23,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-du1h+S+A7CetMXofsYxdGeSsobCgspDB9oUE9WNUbbo=";
   };
 
-  buildInputs = [ which ocaml findlib ];
+  nativeBuildInputs = [ which ocaml findlib ];
+
+  strictDeps = true;
 
   patches = [ ./configure.sh.patch ./Makefile.config.example.patch ];
 
diff --git a/pkgs/development/ocaml-modules/jsonm/default.nix b/pkgs/development/ocaml-modules/jsonm/default.nix
index c228242fda9..2b9c9918382 100644
--- a/pkgs/development/ocaml-modules/jsonm/default.nix
+++ b/pkgs/development/ocaml-modules/jsonm/default.nix
@@ -9,10 +9,12 @@ stdenv.mkDerivation rec {
     sha256 = "1176dcmxb11fnw49b7yysvkjh0kpzx4s48lmdn5psq9vshp5c29w";
   };
 
-  buildInputs = [ findlib topkg ];
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
   propagatedBuildInputs = [ uutf ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/lablgl/default.nix b/pkgs/development/ocaml-modules/lablgl/default.nix
index da4318aef4c..85c27f93a09 100644
--- a/pkgs/development/ocaml-modules/lablgl/default.nix
+++ b/pkgs/development/ocaml-modules/lablgl/default.nix
@@ -15,7 +15,8 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:141kc816iv59z96738i3vn9m9iw9g2zhi45hk4cchpwd99ar5l6k";
   };
 
-  buildInputs = [ ocaml findlib freeglut ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ freeglut ];
   propagatedBuildInputs = [ libGLU libGL ];
 
   patches = [ ./Makefile.config.patch ./META.patch ];
diff --git a/pkgs/development/ocaml-modules/lablgtk-extras/1.4.nix b/pkgs/development/ocaml-modules/lablgtk-extras/1.4.nix
index f2fbc71b5a9..bcf82e1c384 100644
--- a/pkgs/development/ocaml-modules/lablgtk-extras/1.4.nix
+++ b/pkgs/development/ocaml-modules/lablgtk-extras/1.4.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "09fqxwdib7r9yxynknc9gv3jw2hnhj5cak7q5jngk6m8rzvmhfcc";
   };
 
-  buildInputs = [ ocaml findlib camlp4 ];
+  nativeBuildInputs = [ ocaml findlib camlp4 ];
   propagatedBuildInputs = [ config-file lablgtk xmlm ];
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/lablgtk-extras/default.nix b/pkgs/development/ocaml-modules/lablgtk-extras/default.nix
index d97f2f5bffd..736e345dfb3 100644
--- a/pkgs/development/ocaml-modules/lablgtk-extras/default.nix
+++ b/pkgs/development/ocaml-modules/lablgtk-extras/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sha256 = "1bbdp5j18s582mmyd7qiaq1p08g2ag4gl7x65pmzahbhg719hjda";
   };
 
-  buildInputs = [ ocaml findlib camlp4 ];
+  nativeBuildInputs = [ ocaml findlib camlp4 ];
   propagatedBuildInputs = [ config-file lablgtk xmlm ];
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/lablgtk/2.14.0.nix b/pkgs/development/ocaml-modules/lablgtk/2.14.0.nix
index f64b6571970..f37c3b5c6f9 100644
--- a/pkgs/development/ocaml-modules/lablgtk/2.14.0.nix
+++ b/pkgs/development/ocaml-modules/lablgtk/2.14.0.nix
@@ -16,8 +16,8 @@ stdenv.mkDerivation (rec {
     sha256 = "1fnh0amm7lwgyjdhmlqgsp62gwlar1140425yc1j6inwmgnsp0a9";
   };
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml findlib gtk2 libgnomecanvas gtksourceview camlp4 ];
+  nativeBuildInputs = [ pkg-config ocaml findlib camlp4 ];
+  buildInputs = [ gtk2 libgnomecanvas gtksourceview ];
 
   configureFlags = [ "--with-libdir=$(out)/lib/ocaml/${ocaml.version}/site-lib" ];
   buildFlags = [ "world" ];
diff --git a/pkgs/development/ocaml-modules/lablgtk/default.nix b/pkgs/development/ocaml-modules/lablgtk/default.nix
index a442ae35aa5..36ade6979c3 100644
--- a/pkgs/development/ocaml-modules/lablgtk/default.nix
+++ b/pkgs/development/ocaml-modules/lablgtk/default.nix
@@ -23,8 +23,8 @@ stdenv.mkDerivation {
   pname = "lablgtk";
   inherit (param) version src;
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml findlib gtk2 libgnomecanvas gtksourceview ];
+  nativeBuildInputs = [ pkg-config ocaml findlib ];
+  buildInputs = [ gtk2 libgnomecanvas gtksourceview ];
 
   configureFlags = [ "--with-libdir=$(out)/lib/ocaml/${ocaml.version}/site-lib" ];
   buildFlags = [ "world" ];
diff --git a/pkgs/development/ocaml-modules/labltk/default.nix b/pkgs/development/ocaml-modules/labltk/default.nix
index 971668ce0e1..56e79ffc590 100644
--- a/pkgs/development/ocaml-modules/labltk/default.nix
+++ b/pkgs/development/ocaml-modules/labltk/default.nix
@@ -51,7 +51,8 @@ stdenv.mkDerivation rec {
   inherit (param) version src;
   pname = "ocaml${ocaml.version}-labltk";
 
-  buildInputs = [ ocaml findlib tcl tk makeWrapper ];
+  nativeBuildInputs = [ ocaml findlib makeWrapper ];
+  buildInputs = [ tcl tk ];
 
   configureFlags = [ "--use-findlib" "--installbindir" "$(out)/bin" ];
   dontAddPrefix = true;
diff --git a/pkgs/development/ocaml-modules/llvm/default.nix b/pkgs/development/ocaml-modules/llvm/default.nix
index 264d95f39f6..9ab3d906ab1 100644
--- a/pkgs/development/ocaml-modules/llvm/default.nix
+++ b/pkgs/development/ocaml-modules/llvm/default.nix
@@ -8,10 +8,12 @@ stdenv.mkDerivation {
 
   inherit (libllvm) src;
 
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ python2 ocaml findlib ctypes ];
+  nativeBuildInputs = [ cmake python2 ocaml findlib ];
+  buildInputs = [ ctypes ];
   propagatedBuildInputs = [ libllvm ];
 
+  strictDeps = true;
+
   cmakeFlags = [
     "-DBUILD_SHARED_LIBS=YES" # fixes bytecode builds
     "-DLLVM_OCAML_OUT_OF_TREE=TRUE"
diff --git a/pkgs/development/ocaml-modules/logs/default.nix b/pkgs/development/ocaml-modules/logs/default.nix
index 157e7c52fee..4359f09ebd3 100644
--- a/pkgs/development/ocaml-modules/logs/default.nix
+++ b/pkgs/development/ocaml-modules/logs/default.nix
@@ -21,11 +21,13 @@ stdenv.mkDerivation rec {
     sha256 = "1jnmd675wmsmdwyb5mx5b0ac66g4c6gpv5s4mrx2j6pb0wla1x46";
   };
 
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
-  buildInputs = [ findlib topkg fmt cmdliner lwt ]
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ fmt cmdliner lwt topkg ]
     ++ lib.optional jsooSupport js_of_ocaml;
   propagatedBuildInputs = [ result ];
 
+  strictDeps = true;
+
   buildPhase = "${topkg.run} build --with-js_of_ocaml ${lib.boolToString jsooSupport}";
 
   inherit (topkg) installPhase;
diff --git a/pkgs/development/ocaml-modules/lua-ml/default.nix b/pkgs/development/ocaml-modules/lua-ml/default.nix
index 8a4f58ccbbd..586fc395064 100644
--- a/pkgs/development/ocaml-modules/lua-ml/default.nix
+++ b/pkgs/development/ocaml-modules/lua-ml/default.nix
@@ -16,8 +16,9 @@ stdenv.mkDerivation rec {
     sha256 = "04lv98nxmzanvyn4c0k6k0ax29f5xfdl8qzpf5hwadslq213a044";
   };
 
-  nativeBuildInputs = [ opaline ];
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ opaline ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
 
   buildFlags = [ "lib" ];
 
diff --git a/pkgs/development/ocaml-modules/lwt-exit/default.nix b/pkgs/development/ocaml-modules/lwt-exit/default.nix
index 34aadc8761f..a2a6f14524f 100644
--- a/pkgs/development/ocaml-modules/lwt-exit/default.nix
+++ b/pkgs/development/ocaml-modules/lwt-exit/default.nix
@@ -24,7 +24,8 @@ buildDunePackage rec {
     ptime
   ];
 
-  doCheck = true;
+  # for some reason this never exits
+  doCheck = false;
 
   meta = {
     description = "An opinionated clean-exit and signal-handling library for Lwt programs";
diff --git a/pkgs/development/ocaml-modules/lwt/default.nix b/pkgs/development/ocaml-modules/lwt/default.nix
index 76e973a813e..c9d5200d876 100644
--- a/pkgs/development/ocaml-modules/lwt/default.nix
+++ b/pkgs/development/ocaml-modules/lwt/default.nix
@@ -19,9 +19,12 @@ buildDunePackage rec {
     sha256 = "sha256-XpoRKcdNo2j05Gxm5wmKSdwqimFDSWvmLyooPYTHAjM=";
   };
 
-  nativeBuildInputs = [ pkg-config cppo dune-configurator ];
-  buildInputs = optional (!versionAtLeast ocaml.version "4.08") ocaml-syntax-shims
-   ++ optional (!versionAtLeast ocaml.version "4.07") ncurses;
+  strictDeps = true;
+
+  nativeBuildInputs = [ pkg-config cppo ];
+  buildInputs = [ dune-configurator ]
+    ++ optional (!versionAtLeast ocaml.version "4.08") ocaml-syntax-shims
+    ++ optional (!versionAtLeast ocaml.version "4.07") ncurses;
   propagatedBuildInputs = [ libev mmap ocplib-endian seq result ];
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/macaque/default.nix b/pkgs/development/ocaml-modules/macaque/default.nix
index a91e898227d..d47c0c4f11c 100644
--- a/pkgs/development/ocaml-modules/macaque/default.nix
+++ b/pkgs/development/ocaml-modules/macaque/default.nix
@@ -11,8 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-W9ZFaINYYtIikKy/ZqdlKeFQSA7DQT9plc3+ZhlSIJI=";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild camlp4 ];
-  propagatedBuildInputs = [ pgocaml ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild camlp4 ];
+  propagatedBuildInputs = [ pgocaml camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/magick/default.nix b/pkgs/development/ocaml-modules/magick/default.nix
index f9fec120a62..87c43fb6869 100644
--- a/pkgs/development/ocaml-modules/magick/default.nix
+++ b/pkgs/development/ocaml-modules/magick/default.nix
@@ -13,8 +13,10 @@ stdenv.mkDerivation rec {
     sha256 = "0gn9l2qdr8gby2x8c2mb59x1kipb2plr45rbq6ymcxyi0wmzfh3q";
   };
 
-  nativeBuildInputs = [ which pkg-config ];
-  buildInputs = [ ocaml findlib imagemagick ];
+  nativeBuildInputs = [ which pkg-config ocaml findlib ];
+  buildInputs = [ imagemagick ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/merlin-extend/default.nix b/pkgs/development/ocaml-modules/merlin-extend/default.nix
index 6d4fcad0977..9cb35f34c1c 100644
--- a/pkgs/development/ocaml-modules/merlin-extend/default.nix
+++ b/pkgs/development/ocaml-modules/merlin-extend/default.nix
@@ -11,7 +11,9 @@ buildDunePackage rec {
     sha256 = "0hvc4mz92x3rl2dxwrhvhzwl4gilnyvvwcqgr45vmdpyjyp3dwn2";
   };
 
-  buildInputs = [ cppo ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ cppo ];
 
   meta = with lib; {
     homepage = "https://github.com/let-def/merlin-extend";
diff --git a/pkgs/development/ocaml-modules/mirage-crypto/default.nix b/pkgs/development/ocaml-modules/mirage-crypto/default.nix
index 102d3d2de07..c942972597a 100644
--- a/pkgs/development/ocaml-modules/mirage-crypto/default.nix
+++ b/pkgs/development/ocaml-modules/mirage-crypto/default.nix
@@ -19,13 +19,16 @@ buildDunePackage rec {
   doCheck = true;
   checkInputs = [ ounit ];
 
-  nativeBuildInputs = [ dune-configurator pkg-config ];
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ dune-configurator  ];
   propagatedBuildInputs = [
     cstruct eqaf
   ] ++ lib.optionals withFreestanding [
     ocaml-freestanding
   ];
 
+  strictDeps = !doCheck;
+
   meta = with lib; {
     homepage = "https://github.com/mirage/mirage-crypto";
     description = "Simple symmetric cryptography for the modern age";
diff --git a/pkgs/development/ocaml-modules/mirage-crypto/ec.nix b/pkgs/development/ocaml-modules/mirage-crypto/ec.nix
index bcd7a1f04f2..5506243ec3a 100644
--- a/pkgs/development/ocaml-modules/mirage-crypto/ec.nix
+++ b/pkgs/development/ocaml-modules/mirage-crypto/ec.nix
@@ -1,4 +1,5 @@
 { lib
+, ocaml
 , buildDunePackage
 , mirage-crypto
 , dune-configurator
@@ -16,18 +17,18 @@
 , ocaml-freestanding
 }:
 
-buildDunePackage {
+buildDunePackage rec {
   pname = "mirage-crypto-ec";
 
   inherit (mirage-crypto)
     minimumOCamlVersion
     src
     version
-    useDune2
-    ;
+    useDune2;
 
-  nativeBuildInputs = [
-    pkg-config
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [
+    ocaml
     dune-configurator
   ];
   propagatedBuildInputs = [
@@ -38,6 +39,8 @@ buildDunePackage {
     ocaml-freestanding
   ];
 
+  strictDeps = !doCheck;
+
   doCheck = true;
   checkInputs = [
     hex
diff --git a/pkgs/development/ocaml-modules/mirage-crypto/pk.nix b/pkgs/development/ocaml-modules/mirage-crypto/pk.nix
index 82400b5da7c..9a2b9c98e45 100644
--- a/pkgs/development/ocaml-modules/mirage-crypto/pk.nix
+++ b/pkgs/development/ocaml-modules/mirage-crypto/pk.nix
@@ -1,7 +1,7 @@
 { buildDunePackage, ounit, randomconv, mirage-crypto, mirage-crypto-rng
 , cstruct, sexplib0, zarith, eqaf, gmp }:
 
-buildDunePackage {
+buildDunePackage rec {
   pname = "mirage-crypto-pk";
 
   inherit (mirage-crypto) version src useDune2 minimumOCamlVersion;
@@ -10,6 +10,8 @@ buildDunePackage {
   propagatedBuildInputs = [ cstruct mirage-crypto mirage-crypto-rng
                             zarith eqaf sexplib0 ];
 
+  strictDeps = !doCheck;
+
   doCheck = true;
   checkInputs = [ ounit randomconv ];
 
diff --git a/pkgs/development/ocaml-modules/mirage-crypto/rng-async.nix b/pkgs/development/ocaml-modules/mirage-crypto/rng-async.nix
index e8c8dd06eab..91da7aa5681 100644
--- a/pkgs/development/ocaml-modules/mirage-crypto/rng-async.nix
+++ b/pkgs/development/ocaml-modules/mirage-crypto/rng-async.nix
@@ -8,7 +8,7 @@ buildDunePackage {
 
   inherit (mirage-crypto) useDune2 version minimumOCamlVersion src;
 
-  nativeBuildInputs = [
+  buildInputs = [
     dune-configurator
   ];
 
@@ -19,6 +19,8 @@ buildDunePackage {
     mirage-crypto-rng
   ];
 
+  strictDeps = true;
+
   meta = mirage-crypto.meta // {
     description = "Feed the entropy source in an Async-friendly way";
   };
diff --git a/pkgs/development/ocaml-modules/mirage-crypto/rng-mirage.nix b/pkgs/development/ocaml-modules/mirage-crypto/rng-mirage.nix
index 5152d3c8ecd..8d67ade9b46 100644
--- a/pkgs/development/ocaml-modules/mirage-crypto/rng-mirage.nix
+++ b/pkgs/development/ocaml-modules/mirage-crypto/rng-mirage.nix
@@ -3,7 +3,7 @@
 , logs, lwt
 }:
 
-buildDunePackage {
+buildDunePackage rec {
   pname = "mirage-crypto-rng-mirage";
 
   inherit (mirage-crypto-rng) version src useDune2 minimumOCamlVersion;
@@ -14,6 +14,8 @@ buildDunePackage {
   propagatedBuildInputs = [ duration cstruct mirage-crypto-rng mirage-runtime
                             mirage-time mirage-clock logs lwt ];
 
+  strictDeps = !doCheck;
+
   meta = mirage-crypto-rng.meta // {
     description = "Entropy collection for a cryptographically secure PRNG";
   };
diff --git a/pkgs/development/ocaml-modules/mirage-crypto/rng.nix b/pkgs/development/ocaml-modules/mirage-crypto/rng.nix
index b4da0681635..2281f10580c 100644
--- a/pkgs/development/ocaml-modules/mirage-crypto/rng.nix
+++ b/pkgs/development/ocaml-modules/mirage-crypto/rng.nix
@@ -1,7 +1,7 @@
 { buildDunePackage, mirage-crypto, ounit, randomconv, dune-configurator
 , cstruct, duration, logs, mtime, ocaml_lwt }:
 
-buildDunePackage {
+buildDunePackage rec {
   pname = "mirage-crypto-rng";
 
   inherit (mirage-crypto) version src useDune2 minimumOCamlVersion;
@@ -9,9 +9,11 @@ buildDunePackage {
   doCheck = true;
   checkInputs = [ ounit randomconv ];
 
-  nativeBuildInputs = [ dune-configurator ];
+  buildInputs = [ dune-configurator ];
   propagatedBuildInputs = [ cstruct mirage-crypto duration logs mtime ocaml_lwt ];
 
+  strictDeps = !doCheck;
+
   meta = mirage-crypto.meta // {
     description = "A cryptographically secure PRNG";
   };
diff --git a/pkgs/development/ocaml-modules/mlgmp/default.nix b/pkgs/development/ocaml-modules/mlgmp/default.nix
index ffd78150689..a396549d76f 100644
--- a/pkgs/development/ocaml-modules/mlgmp/default.nix
+++ b/pkgs/development/ocaml-modules/mlgmp/default.nix
@@ -21,7 +21,10 @@ stdenv.mkDerivation rec {
   ];
 
   preConfigure = "make clean";
-  buildInputs = [ocaml findlib gmp mpfr ncurses];
+  nativeBuildInputs = [ocaml findlib ];
+  buildInputs = [ gmp mpfr ncurses];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/mlgmpidl/default.nix b/pkgs/development/ocaml-modules/mlgmpidl/default.nix
index 4e27c8ff3bb..d12329b811e 100644
--- a/pkgs/development/ocaml-modules/mlgmpidl/default.nix
+++ b/pkgs/development/ocaml-modules/mlgmpidl/default.nix
@@ -10,7 +10,10 @@ stdenv.mkDerivation rec {
     sha256 = "17xqiclaqs4hmnb92p9z6z9a1xfr31vcn8nlnj8ykk57by31vfza";
   };
 
-  buildInputs = [ perl gmp mpfr ocaml findlib camlidl ];
+  nativeBuildInputs = [ perl ocaml findlib mpfr camlidl ];
+  buildInputs = [ gmp mpfr ];
+
+  strictDeps = true;
 
   prefixKey = "-prefix ";
   configureFlags = [
@@ -20,7 +23,7 @@ stdenv.mkDerivation rec {
 
   postConfigure = ''
     sed -i Makefile \
-      -e 's|^	/bin/rm |	rm |'
+      -e 's|/bin/rm|rm|'
     mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib/stublibs
   '';
 
diff --git a/pkgs/development/ocaml-modules/mtime/default.nix b/pkgs/development/ocaml-modules/mtime/default.nix
index 3e4438f6da5..ace29633964 100644
--- a/pkgs/development/ocaml-modules/mtime/default.nix
+++ b/pkgs/development/ocaml-modules/mtime/default.nix
@@ -24,9 +24,10 @@ stdenv.mkDerivation {
     inherit (param) sha256;
   };
 
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
-  buildInputs = [ findlib topkg ]
-  ++ optional jsooSupport js_of_ocaml;
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ] ++ optional jsooSupport js_of_ocaml;
+
+  strictDeps = true;
 
   buildPhase = "${topkg.buildPhase} --with-js_of_ocaml ${boolToString jsooSupport}";
 
diff --git a/pkgs/development/ocaml-modules/mysql/default.nix b/pkgs/development/ocaml-modules/mysql/default.nix
index 6ccdfa9cf81..c980984a26c 100644
--- a/pkgs/development/ocaml-modules/mysql/default.nix
+++ b/pkgs/development/ocaml-modules/mysql/default.nix
@@ -22,12 +22,14 @@ stdenv.mkDerivation rec {
      "--libdir=$out/lib/ocaml/${ocaml.version}/site-lib/mysql"
   ];
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
 
   createFindlibDestdir = true;
 
   propagatedBuildInputs = [ libmysqlclient ];
 
+  strictDeps = true;
+
   patches = [
     (fetchpatch {
       url = "https://github.com/ygrek/ocaml-mysql/compare/v1.2.1...d6d1b3b262ae2cf493ef56f1dd7afcf663a70a26.patch";
diff --git a/pkgs/development/ocaml-modules/nocrypto/default.nix b/pkgs/development/ocaml-modules/nocrypto/default.nix
index fdd24094c17..d179c8c1c90 100644
--- a/pkgs/development/ocaml-modules/nocrypto/default.nix
+++ b/pkgs/development/ocaml-modules/nocrypto/default.nix
@@ -56,9 +56,11 @@ stdenv.mkDerivation rec {
   ];
 
   nativeBuildInputs = [ ocaml findlib ocamlbuild cc-wrapper ];
-  buildInputs = [ ocamlbuild findlib topkg cpuid ocb-stubblr ];
+  buildInputs = [ topkg cpuid ocb-stubblr ocamlbuild ];
   propagatedBuildInputs = [ cstruct ppx_deriving ppx_sexp_conv sexplib zarith ] ++ optional withLwt cstruct-lwt;
 
+  strictDeps = true;
+
   buildPhase = "${topkg.buildPhase} --accelerate false --with-lwt ${boolToString withLwt}";
   inherit (topkg) installPhase;
 
diff --git a/pkgs/development/ocaml-modules/notty/default.nix b/pkgs/development/ocaml-modules/notty/default.nix
index 94342bb3128..1598b2ee5cd 100644
--- a/pkgs/development/ocaml-modules/notty/default.nix
+++ b/pkgs/development/ocaml-modules/notty/default.nix
@@ -19,10 +19,13 @@ stdenv.mkDerivation rec {
     sha256 = "1y3hx8zjri3x50nyiqal5gak1sw54gw3xssrqbj7srinvkdmrz1q";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ocb-stubblr ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ ocb-stubblr topkg ocamlbuild ];
   propagatedBuildInputs = [ result uucp uuseg uutf ] ++
                           optional withLwt lwt;
 
+  strictDeps = true;
+
   buildPhase = topkg.buildPhase
   + " --with-lwt ${boolToString withLwt}";
 
diff --git a/pkgs/development/ocaml-modules/num/default.nix b/pkgs/development/ocaml-modules/num/default.nix
index b1293a2ab55..1f978a90df4 100644
--- a/pkgs/development/ocaml-modules/num/default.nix
+++ b/pkgs/development/ocaml-modules/num/default.nix
@@ -17,10 +17,10 @@ stdenv.mkDerivation rec {
   ] ++ lib.optional withStatic ./enable-static.patch;
 
   nativeBuildInputs = [ ocaml findlib ];
-  buildInputs = [ ocaml findlib ];
 
-  createFindlibDestdir = true;
+  strictDeps = true;
 
+  createFindlibDestdir = true;
 
   meta = {
     description = "Legacy Num library for arbitrary-precision integer and rational arithmetic";
diff --git a/pkgs/development/ocaml-modules/ocaml-cairo/default.nix b/pkgs/development/ocaml-modules/ocaml-cairo/default.nix
index 7d2960fc5a6..6748619d492 100644
--- a/pkgs/development/ocaml-modules/ocaml-cairo/default.nix
+++ b/pkgs/development/ocaml-modules/ocaml-cairo/default.nix
@@ -19,9 +19,8 @@ stdenv.mkDerivation rec {
 
   patches = [ ./META.patch ];
 
-  nativeBuildInputs = [ pkg-config unzip ];
-  buildInputs = [ ocaml automake gnum4 autoconf
-                  findlib freetype lablgtk cairo gdk-pixbuf gtk2 pango ];
+  nativeBuildInputs = [ pkg-config unzip ocaml automake gnum4 autoconf findlib ];
+  buildInputs = [ freetype lablgtk cairo gdk-pixbuf gtk2 pango ];
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/ocaml-libvirt/default.nix b/pkgs/development/ocaml-modules/ocaml-libvirt/default.nix
index 581890178ea..b4410981afb 100644
--- a/pkgs/development/ocaml-modules/ocaml-libvirt/default.nix
+++ b/pkgs/development/ocaml-modules/ocaml-libvirt/default.nix
@@ -13,9 +13,9 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ libvirt ];
 
-  nativeBuildInputs = [ autoreconfHook pkg-config findlib perl ];
+  nativeBuildInputs = [ autoreconfHook pkg-config findlib perl ocaml ];
 
-  buildInputs = [ ocaml ];
+  strictDeps = true;
 
   buildFlags = [ "all" "opt" "CPPFLAGS=-Wno-error" ];
   installTargets = "install-opt";
diff --git a/pkgs/development/ocaml-modules/ocaml-r/default.nix b/pkgs/development/ocaml-modules/ocaml-r/default.nix
index d76a98fc05c..fcee63de3b5 100644
--- a/pkgs/development/ocaml-modules/ocaml-r/default.nix
+++ b/pkgs/development/ocaml-modules/ocaml-r/default.nix
@@ -27,7 +27,11 @@ buildDunePackage rec {
     ' libRmath"' '"'
   '';
 
-  buildInputs = [ pkg-config R dune-configurator stdio ];
+  # This currently fails with dune
+  strictDeps = false;
+
+  nativeBuildInputs = [ pkg-config R ];
+  buildInputs = [ dune-configurator stdio R ];
 
   doCheck = true;
   checkInputs = [ alcotest ];
diff --git a/pkgs/development/ocaml-modules/ocamlfuse/default.nix b/pkgs/development/ocaml-modules/ocamlfuse/default.nix
index c2ca6a2cc8a..4dcaca42788 100644
--- a/pkgs/development/ocaml-modules/ocamlfuse/default.nix
+++ b/pkgs/development/ocaml-modules/ocamlfuse/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildDunePackage, fetchFromGitHub, camlidl, fuse }:
+{ lib, buildDunePackage, fetchFromGitHub, camlidl, fuse, dune-configurator }:
 
 buildDunePackage {
   pname = "ocamlfuse";
@@ -11,6 +11,11 @@ buildDunePackage {
     sha256 = "1v9g0wh7rnjkrjrnw50145g6ry38plyjs8fq8w0nlzwizhf3qhff";
   };
 
+  # This currently fails with dune
+  strictDeps = false;
+
+  nativeBuildInputs = [ camlidl ];
+  buildInputs = [ dune-configurator ];
   propagatedBuildInputs = [ camlidl fuse ];
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/ocamlnat/default.nix b/pkgs/development/ocaml-modules/ocamlnat/default.nix
index f8d20b7124b..66bd00707ad 100644
--- a/pkgs/development/ocaml-modules/ocamlnat/default.nix
+++ b/pkgs/development/ocaml-modules/ocamlnat/default.nix
@@ -12,7 +12,10 @@ stdenv.mkDerivation rec {
     sha256 = "0dyvy0j6f47laxhnadvm71z1py9hz9zd49hamf6bij99cggb2ij1";
   };
 
-  buildInputs = [ocaml findlib ounit];
+  nativeBuildInputs = [ocaml findlib ];
+  buildInputs = [ ounit];
+
+  strictDeps = true;
 
   prefixKey = "--prefix ";
 
diff --git a/pkgs/development/ocaml-modules/ocamlnet/default.nix b/pkgs/development/ocaml-modules/ocamlnet/default.nix
index d6e8f83968a..d435d7a0484 100644
--- a/pkgs/development/ocaml-modules/ocamlnet/default.nix
+++ b/pkgs/development/ocaml-modules/ocamlnet/default.nix
@@ -15,8 +15,10 @@ stdenv.mkDerivation rec {
     sha256 = "1vlwxjxr946gdl61a1d7yk859cijq45f60dhn54ik3w4g6cx33pr";
   };
 
-  nativeBuildInputs = [ pkg-config which ];
-  buildInputs = [ ncurses ocaml findlib ocaml_pcre camlzip gnutls nettle ];
+  nativeBuildInputs = [ pkg-config which ocaml findlib ];
+  buildInputs = [ ncurses ocaml_pcre camlzip gnutls nettle ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/ocamlsdl/default.nix b/pkgs/development/ocaml-modules/ocamlsdl/default.nix
index 7c782b5268f..3482aa37e75 100644
--- a/pkgs/development/ocaml-modules/ocamlsdl/default.nix
+++ b/pkgs/development/ocaml-modules/ocamlsdl/default.nix
@@ -17,8 +17,8 @@ stdenv.mkDerivation rec {
     sha256 = "abfb295b263dc11e97fffdd88ea1a28b46df8cc2b196777093e4fe7f509e4f8f";
   };
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ocaml findlib SDL SDL_image SDL_mixer SDL_ttf SDL_gfx lablgl];
+  nativeBuildInputs = [ pkg-config ocaml findlib ];
+  buildInputs = [ SDL SDL_image SDL_mixer SDL_ttf SDL_gfx lablgl ];
 
   propagatedBuildInputs = [ SDL SDL_image SDL_mixer SDL_ttf SDL_gfx pkg-config ];
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/ocb-stubblr/default.nix b/pkgs/development/ocaml-modules/ocb-stubblr/default.nix
index 2f26eb32ffb..fcd63ced7a8 100644
--- a/pkgs/development/ocaml-modules/ocb-stubblr/default.nix
+++ b/pkgs/development/ocaml-modules/ocb-stubblr/default.nix
@@ -12,10 +12,13 @@ stdenv.mkDerivation rec {
 
   patches = [ ./pkg-config.patch ];
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ocamlbuild ];
 
   propagatedBuildInputs = [ astring ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/ocp-ocamlres/default.nix b/pkgs/development/ocaml-modules/ocp-ocamlres/default.nix
index 7635f3a686c..763617be132 100644
--- a/pkgs/development/ocaml-modules/ocp-ocamlres/default.nix
+++ b/pkgs/development/ocaml-modules/ocp-ocamlres/default.nix
@@ -14,7 +14,11 @@ stdenv.mkDerivation rec {
     sha256 = "0smfwrj8qhzknhzawygxi0vgl2af4vyi652fkma59rzjpvscqrnn";
   };
 
-  buildInputs = [ ocaml findlib astring pprint ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ astring pprint ];
+
+  strictDeps = true;
+
   createFindlibDestdir = true;
 
   installFlags = [ "BINDIR=$(out)/bin" ];
diff --git a/pkgs/development/ocaml-modules/ocplib-simplex/default.nix b/pkgs/development/ocaml-modules/ocplib-simplex/default.nix
index 8435d1c5e51..474f69546d1 100644
--- a/pkgs/development/ocaml-modules/ocplib-simplex/default.nix
+++ b/pkgs/development/ocaml-modules/ocplib-simplex/default.nix
@@ -15,8 +15,9 @@ stdenv.mkDerivation {
     sha256 = "09niyidrjzrj8g1qwx4wgsdf5m6cwrnzg7zsgala36jliic4di60";
   };
 
-  nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ autoreconfHook ocaml findlib ];
+
+  strictDeps = true;
 
   installFlags = [ "LIBDIR=$(OCAMLFIND_DESTDIR)" ];
 
diff --git a/pkgs/development/ocaml-modules/ocsigen-deriving/default.nix b/pkgs/development/ocaml-modules/ocsigen-deriving/default.nix
index d2e20838eca..480ea6daf20 100644
--- a/pkgs/development/ocaml-modules/ocsigen-deriving/default.nix
+++ b/pkgs/development/ocaml-modules/ocsigen-deriving/default.nix
@@ -26,7 +26,10 @@ stdenv.mkDerivation rec {
 
   createFindlibDestdir = true;
 
-  buildInputs = [ ocaml findlib ocamlbuild oasis camlp4 num ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild oasis camlp4 ];
+  buildInputs = [ oasis camlp4 ocamlbuild num ];
+
+  strictDeps = true;
 
   meta = {
     homepage = "https://github.com/ocsigen/deriving";
diff --git a/pkgs/development/ocaml-modules/ocsigen-start/default.nix b/pkgs/development/ocaml-modules/ocsigen-start/default.nix
index 1fccbbb9b30..118138dc8fd 100644
--- a/pkgs/development/ocaml-modules/ocsigen-start/default.nix
+++ b/pkgs/development/ocaml-modules/ocsigen-start/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchFromGitHub, ocaml, findlib, ocsigen-toolkit, pgocaml_ppx, safepass, yojson
-, cohttp-lwt-unix
+, cohttp-lwt-unix, eliom
 , resource-pooling
 , ocamlnet
 }:
@@ -8,9 +8,11 @@ stdenv.mkDerivation rec {
   pname = "ocaml${ocaml.version}-ocsigen-start";
   version = "4.3.0";
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib eliom ];
   propagatedBuildInputs = [ pgocaml_ppx safepass ocsigen-toolkit yojson resource-pooling cohttp-lwt-unix ocamlnet ];
 
+  strictDeps = true;
+
   patches = [ ./templates-dir.patch ];
 
   src = fetchFromGitHub {
diff --git a/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix b/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix
index 78420d09779..1b2dd72a2ec 100644
--- a/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix
+++ b/pkgs/development/ocaml-modules/ocsigen-toolkit/default.nix
@@ -8,7 +8,9 @@ stdenv.mkDerivation rec {
  version = "3.0.1";
 
  propagatedBuildInputs = [ calendar js_of_ocaml-ppx_deriving_json eliom ];
- buildInputs = [ ocaml findlib opaline ];
+ nativeBuildInputs = [ ocaml findlib opaline eliom ];
+
+  strictDeps = true;
 
  installPhase = ''
     runHook preInstall
diff --git a/pkgs/development/ocaml-modules/ocurl/default.nix b/pkgs/development/ocaml-modules/ocurl/default.nix
index ea2af8dd4c8..5e815d4dca6 100644
--- a/pkgs/development/ocaml-modules/ocurl/default.nix
+++ b/pkgs/development/ocaml-modules/ocurl/default.nix
@@ -13,8 +13,12 @@ stdenv.mkDerivation rec {
     sha256 = "0n621cxb9012pj280c7821qqsdhypj8qy9qgrah79dkh6a8h2py6";
   };
 
-  buildInputs = [ pkg-config ocaml findlib ncurses ];
+  nativeBuildInputs = [ pkg-config ocaml findlib ];
+  buildInputs = [ ncurses ];
   propagatedBuildInputs = [ curl lwt ];
+
+  strictDeps = true;
+
   createFindlibDestdir = true;
   meta = {
     description = "OCaml bindings to libcurl";
diff --git a/pkgs/development/ocaml-modules/odate/default.nix b/pkgs/development/ocaml-modules/odate/default.nix
index aed5e92765f..8967a381547 100644
--- a/pkgs/development/ocaml-modules/odate/default.nix
+++ b/pkgs/development/ocaml-modules/odate/default.nix
@@ -17,7 +17,9 @@ buildDunePackage rec {
     sha256 = "1dk33lr0g2jnia2gqsm6nnc7nf256qgkm3v30w477gm6y2ppfm3h";
   };
 
-  buildInputs = [ menhir ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ menhir ];
 
   meta = {
     description = "Date and duration in OCaml";
diff --git a/pkgs/development/ocaml-modules/odn/default.nix b/pkgs/development/ocaml-modules/odn/default.nix
index 9179ce3f1d1..66fc5d1f187 100644
--- a/pkgs/development/ocaml-modules/odn/default.nix
+++ b/pkgs/development/ocaml-modules/odn/default.nix
@@ -13,7 +13,10 @@ stdenv.mkDerivation rec {
     sha256 = "09a8zdyifpc2nl4hdvg9206142y31cq95ajgij011s1qcg3z93lj";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild type_conv ounit camlp4 ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ type_conv ounit camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/omd/default.nix b/pkgs/development/ocaml-modules/omd/default.nix
index d6cea183d85..b9797e257ab 100644
--- a/pkgs/development/ocaml-modules/omd/default.nix
+++ b/pkgs/development/ocaml-modules/omd/default.nix
@@ -9,7 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "1sgdgzpx96br7npj8mh91cli5mqmzsjpngwm7x4212n3k1d0ivwa";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/opam-repository/default.nix b/pkgs/development/ocaml-modules/opam-repository/default.nix
index 1480a7d5915..ff9ad75fad8 100644
--- a/pkgs/development/ocaml-modules/opam-repository/default.nix
+++ b/pkgs/development/ocaml-modules/opam-repository/default.nix
@@ -15,8 +15,9 @@ buildDunePackage rec {
       --replace "SUBSTITUTE_NIXOS_CURL_PATH" "\"${curl}/bin/curl\""
   '';
 
-  nativeBuildInputs = [ unzip ];
-  buildInputs = [ curl ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ unzip curl ];
   propagatedBuildInputs = [ opam-format ];
 
   meta = opam-format.meta // {
diff --git a/pkgs/development/ocaml-modules/otfm/default.nix b/pkgs/development/ocaml-modules/otfm/default.nix
index 0642b30699c..91d91bdc46f 100644
--- a/pkgs/development/ocaml-modules/otfm/default.nix
+++ b/pkgs/development/ocaml-modules/otfm/default.nix
@@ -17,10 +17,13 @@ stdenv.mkDerivation {
     sha256 = "054s82539k3kc9na6s47g3scsl04icjahpas7pv5351jmsgqcq3k";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
 
   propagatedBuildInputs = [ uutf result ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/otoml/default.nix b/pkgs/development/ocaml-modules/otoml/default.nix
index 17e8fc855ea..c3f53fc611e 100644
--- a/pkgs/development/ocaml-modules/otoml/default.nix
+++ b/pkgs/development/ocaml-modules/otoml/default.nix
@@ -19,7 +19,9 @@ buildDunePackage rec {
     sha256 = "0l0c60rzgk11y8xq05kr8q9hkzb3c8vi995mq84x98ys73wb42j3";
   };
 
-  buildInputs = [ menhir ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ menhir ];
 
   propagatedBuildInputs = [ menhirLib uutf ];
 
diff --git a/pkgs/development/ocaml-modules/ounit/default.nix b/pkgs/development/ocaml-modules/ounit/default.nix
index fbb75e61330..a40111cd3b3 100644
--- a/pkgs/development/ocaml-modules/ounit/default.nix
+++ b/pkgs/development/ocaml-modules/ounit/default.nix
@@ -4,9 +4,11 @@ stdenv.mkDerivation {
   pname = "ocaml${ocaml.version}-ounit";
   inherit (ounit2) version src meta;
 
-  buildInputs = [ findlib ];
+  nativeBuildInputs = [ findlib ];
   propagatedBuildInputs = [ ounit2 ];
 
+  strictDeps = true;
+
   dontBuild = true;
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/pipebang/default.nix b/pkgs/development/ocaml-modules/pipebang/default.nix
index 489ca3d2c70..251aeb8de8e 100644
--- a/pkgs/development/ocaml-modules/pipebang/default.nix
+++ b/pkgs/development/ocaml-modules/pipebang/default.nix
@@ -1,4 +1,4 @@
-{ lib, buildOcaml, fetchFromGitHub }:
+{ lib, buildOcaml, fetchFromGitHub, camlp4 }:
 
 buildOcaml rec {
   pname = "pipebang";
@@ -13,6 +13,10 @@ buildOcaml rec {
     sha256 = "sha256-9A3X/ciL5HtuKQ5awS+hDDBLL5ytOr12wHsmJLNRn+Q=";
   };
 
+  strictDeps = true;
+
+  buildInputs = [ camlp4 ];
+
   meta = with lib; {
     homepage = "https://github.com/janestreet/pipebang";
     description = "Syntax extension to transform x |! f into f x";
diff --git a/pkgs/development/ocaml-modules/piqi-ocaml/default.nix b/pkgs/development/ocaml-modules/piqi-ocaml/default.nix
index 590c001c419..4f2e4693357 100644
--- a/pkgs/development/ocaml-modules/piqi-ocaml/default.nix
+++ b/pkgs/development/ocaml-modules/piqi-ocaml/default.nix
@@ -12,7 +12,10 @@ stdenv.mkDerivation rec {
     sha256 = "1913jpsb8mvqi8609j4g4sm5jhg50dq0xqxgy8nmvknfryyc89nm";
   };
 
-  buildInputs = [ ocaml findlib piqi stdlib-shims ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ piqi stdlib-shims ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/piqi/default.nix b/pkgs/development/ocaml-modules/piqi/default.nix
index faeb804d8aa..45d65a5be04 100644
--- a/pkgs/development/ocaml-modules/piqi/default.nix
+++ b/pkgs/development/ocaml-modules/piqi/default.nix
@@ -12,9 +12,11 @@ stdenv.mkDerivation rec {
     sha256 = "0v04hs85xv6d4ysqxyv1dik34dx49yab9shpi4x7iv19qlzl7csb";
   };
 
-  buildInputs = [ ocaml findlib which ];
+  nativeBuildInputs = [ ocaml findlib which ];
   propagatedBuildInputs = [ sedlex_2 xmlm easy-format base64 ];
 
+  strictDeps = true;
+
   patches = [ ./no-ocamlpath-override.patch ];
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/ppx_cstubs/default.nix b/pkgs/development/ocaml-modules/ppx_cstubs/default.nix
index 935d67f7084..f4794eea76e 100644
--- a/pkgs/development/ocaml-modules/ppx_cstubs/default.nix
+++ b/pkgs/development/ocaml-modules/ppx_cstubs/default.nix
@@ -9,6 +9,7 @@
 , num
 , ppxlib
 , re
+, findlib
 }:
 
 buildDunePackage rec {
@@ -26,17 +27,21 @@ buildDunePackage rec {
     sha256 = "15cjb9ygnvp2kv85rrb7ncz7yalifyl7wd2hp2cl8r1qrpgi1d0w";
   };
 
+  nativeBuildInputs = [ cppo ];
+
   buildInputs = [
     bigarray-compat
     containers
-    cppo
     ctypes
     integers
     num
     ppxlib
     re
+    findlib
   ];
 
+  strictDeps = true;
+
   meta = with lib; {
     homepage = "https://github.com/fdopen/ppx_cstubs";
     changelog = "https://github.com/fdopen/ppx_cstubs/raw/${version}/CHANGES.md";
diff --git a/pkgs/development/ocaml-modules/ppx_deriving/default.nix b/pkgs/development/ocaml-modules/ppx_deriving/default.nix
index 5563e611346..090c8113ce4 100644
--- a/pkgs/development/ocaml-modules/ppx_deriving/default.nix
+++ b/pkgs/development/ocaml-modules/ppx_deriving/default.nix
@@ -5,7 +5,7 @@
 , ppxlib
 , ppx_derivers
 , result
-, ounit
+, ounit2
 , ocaml-migrate-parsetree
 , ocaml-migrate-parsetree-2
 }:
@@ -37,7 +37,11 @@ buildDunePackage rec {
     inherit (params) sha256;
   };
 
-  buildInputs = [ ppxlib cppo ];
+  # This currently fails with dune
+  strictDeps = false;
+
+  nativeBuildInputs = [ cppo ];
+  buildInputs = [ ppxlib ];
   propagatedBuildInputs = [
     (if params.useOMP2
     then ocaml-migrate-parsetree-2
@@ -47,7 +51,7 @@ buildDunePackage rec {
   ];
 
   doCheck = true;
-  checkInputs = [ ounit ];
+  checkInputs = [ ounit2 ];
 
   meta = with lib; {
     description = "deriving is a library simplifying type-driven code generation on OCaml >=4.02.";
diff --git a/pkgs/development/ocaml-modules/ppx_tools/default.nix b/pkgs/development/ocaml-modules/ppx_tools/default.nix
index 64948c29ae5..59b7c29730a 100644
--- a/pkgs/development/ocaml-modules/ppx_tools/default.nix
+++ b/pkgs/development/ocaml-modules/ppx_tools/default.nix
@@ -5,6 +5,7 @@ let param =
     version = "6.4";
     sha256 = "15v7yfv6gyp8lzlgwi9garz10wpg34dk4072jdv19n6v20zfg7n1";
     useDune2 = true;
+    nativeBuildInputs = [cppo];
     buildInputs = [cppo];
   }; in
 {
@@ -54,7 +55,9 @@ if lib.versionAtLeast param.version "6.0"
 then
   buildDunePackage {
     inherit pname src meta;
-    inherit (param) version useDune2 buildInputs;
+    inherit (param) version useDune2 buildInputs nativeBuildInputs;
+
+    strictDeps = true;
   }
 else
   stdenv.mkDerivation {
@@ -63,7 +66,8 @@ else
     inherit src;
 
     nativeBuildInputs = [ ocaml findlib ];
-    buildInputs = [ ocaml findlib ];
+
+    strictDeps = true;
 
     createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/psmt2-frontend/default.nix b/pkgs/development/ocaml-modules/psmt2-frontend/default.nix
index dbdf3970f63..25c9ec4b870 100644
--- a/pkgs/development/ocaml-modules/psmt2-frontend/default.nix
+++ b/pkgs/development/ocaml-modules/psmt2-frontend/default.nix
@@ -15,7 +15,9 @@ buildDunePackage rec {
 
   minimumOCamlVersion = "4.03";
 
-  buildInputs = [ menhir ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ menhir ];
 
   meta = {
     description = "A simple parser and type-checker for polomorphic extension of the SMT-LIB 2 language";
diff --git a/pkgs/development/ocaml-modules/ptime/default.nix b/pkgs/development/ocaml-modules/ptime/default.nix
index 7015c6058b4..ac30876520a 100644
--- a/pkgs/development/ocaml-modules/ptime/default.nix
+++ b/pkgs/development/ocaml-modules/ptime/default.nix
@@ -11,9 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "1fxq57xy1ajzfdnvv5zfm7ap2nf49znw5f9gbi4kb9vds942ij27";
   };
 
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
-  buildInputs = [ findlib topkg ]
-    ++ lib.optional jsooSupport js_of_ocaml;
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ] ++ lib.optional jsooSupport js_of_ocaml;
+
+  strictDeps = true;
 
   propagatedBuildInputs = [ result ];
 
diff --git a/pkgs/development/ocaml-modules/ptmap/default.nix b/pkgs/development/ocaml-modules/ptmap/default.nix
index 018f1e3edf0..fd59368f82d 100644
--- a/pkgs/development/ocaml-modules/ptmap/default.nix
+++ b/pkgs/development/ocaml-modules/ptmap/default.nix
@@ -14,12 +14,13 @@ buildDunePackage rec {
     sha256 = "1apk61fc1y1g7x3m3c91fnskvxp6i0vk5nxwvipj56k7x2pzilgb";
   };
 
+  strictDeps = true;
+
+  buildInputs = [ stdlib-shims ];
   propagatedBuildInputs = [ seq ];
 
   doCheck = true;
 
-  checkInputs = [ stdlib-shims ];
-
   meta = {
     homepage = "https://www.lri.fr/~filliatr/software.en.html";
     description = "Maps over integers implemented as Patricia trees";
diff --git a/pkgs/development/ocaml-modules/pyml/default.nix b/pkgs/development/ocaml-modules/pyml/default.nix
index 4f7c4b1b2a2..afcc47e38dc 100644
--- a/pkgs/development/ocaml-modules/pyml/default.nix
+++ b/pkgs/development/ocaml-modules/pyml/default.nix
@@ -11,9 +11,11 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-GCO6KlRhJmADFjQ5QF4naMQBskF63yqnJnLnuQsagEk=";
   };
 
-  buildInputs = [
+  nativeBuildInputs = [
     ocaml
     findlib
+  ];
+  buildInputs = [
     utop
     ncurses
   ];
@@ -23,6 +25,8 @@ stdenv.mkDerivation rec {
     stdcompat
   ];
 
+  strictDeps = true;
+
   buildPhase = ''
     make all pymltop pymlutop PREFIX=$out
   '';
diff --git a/pkgs/development/ocaml-modules/react/default.nix b/pkgs/development/ocaml-modules/react/default.nix
index 0edae983069..4e07a2021e3 100644
--- a/pkgs/development/ocaml-modules/react/default.nix
+++ b/pkgs/development/ocaml-modules/react/default.nix
@@ -9,7 +9,10 @@ stdenv.mkDerivation rec {
     sha256 = "1aj8w79gdd9xnrbz7s5p8glcb4pmimi8jp9f439dqnf6ih3mqb3v";
   };
 
-  buildInputs = [ ocaml findlib topkg ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ topkg ];
+
+  strictDeps = true;
 
   inherit (topkg) buildPhase installPhase;
 
diff --git a/pkgs/development/ocaml-modules/reactivedata/default.nix b/pkgs/development/ocaml-modules/reactivedata/default.nix
index bc0c8f9e9b8..23ebb3144d1 100644
--- a/pkgs/development/ocaml-modules/reactivedata/default.nix
+++ b/pkgs/development/ocaml-modules/reactivedata/default.nix
@@ -15,9 +15,11 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-YLkacIbjxZQ/ThgSxjTqviBYih6eW2GX5H7iybQDv1A=";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild opaline ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild opaline ];
   propagatedBuildInputs = [ react ];
 
+  strictDeps = true;
+
   buildPhase = "ocaml pkg/build.ml native=true native-dynlink=true";
 
   installPhase = "opaline -prefix $out -libdir $OCAMLFIND_DESTDIR";
diff --git a/pkgs/development/ocaml-modules/reason-native/cli.nix b/pkgs/development/ocaml-modules/reason-native/cli.nix
index 1a4c020dc35..ee5e7d2774d 100644
--- a/pkgs/development/ocaml-modules/reason-native/cli.nix
+++ b/pkgs/development/ocaml-modules/reason-native/cli.nix
@@ -3,9 +3,12 @@
 {
   pname = "cli";
 
+  nativeBuildInputs = [
+    reason
+  ];
+
   buildInputs = [
     re
-    reason
     pastel
   ];
 }
diff --git a/pkgs/development/ocaml-modules/reason-native/console.nix b/pkgs/development/ocaml-modules/reason-native/console.nix
index c11c12b4673..b4b30cab4a0 100644
--- a/pkgs/development/ocaml-modules/reason-native/console.nix
+++ b/pkgs/development/ocaml-modules/reason-native/console.nix
@@ -3,7 +3,7 @@
 {
   pname = "console";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/dir.nix b/pkgs/development/ocaml-modules/reason-native/dir.nix
index e6eb9c0c403..6b2aa0c3cd8 100644
--- a/pkgs/development/ocaml-modules/reason-native/dir.nix
+++ b/pkgs/development/ocaml-modules/reason-native/dir.nix
@@ -3,7 +3,7 @@
 {
   pname = "dir";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix b/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix
index 749e727feec..a7c663493ef 100644
--- a/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix
+++ b/pkgs/development/ocaml-modules/reason-native/file-context-printer.nix
@@ -3,7 +3,7 @@
 {
   pname = "file-context-printer";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/fp.nix b/pkgs/development/ocaml-modules/reason-native/fp.nix
index ae6ae50705d..8ff2ed65c4c 100644
--- a/pkgs/development/ocaml-modules/reason-native/fp.nix
+++ b/pkgs/development/ocaml-modules/reason-native/fp.nix
@@ -3,7 +3,7 @@
 {
   pname = "fp";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/pastel-console.nix b/pkgs/development/ocaml-modules/reason-native/pastel-console.nix
index f1d2c7cc726..968b9f88af9 100644
--- a/pkgs/development/ocaml-modules/reason-native/pastel-console.nix
+++ b/pkgs/development/ocaml-modules/reason-native/pastel-console.nix
@@ -3,7 +3,7 @@
 {
   pname = "pastel-console";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/pastel.nix b/pkgs/development/ocaml-modules/reason-native/pastel.nix
index a5abc4e219c..f2c975d938e 100644
--- a/pkgs/development/ocaml-modules/reason-native/pastel.nix
+++ b/pkgs/development/ocaml-modules/reason-native/pastel.nix
@@ -5,7 +5,7 @@
 
   minimalOCamlVersion = "4.05";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
   propagatedBuildInputs = [
diff --git a/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix b/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix
index 993bcbefafd..1250dc2d3a7 100644
--- a/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix
+++ b/pkgs/development/ocaml-modules/reason-native/qcheck-rely.nix
@@ -3,7 +3,7 @@
 {
   pname = "qcheck-rely";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/refmterr.nix b/pkgs/development/ocaml-modules/reason-native/refmterr.nix
index 9b14d4a8ba3..b4d6708467f 100644
--- a/pkgs/development/ocaml-modules/reason-native/refmterr.nix
+++ b/pkgs/development/ocaml-modules/reason-native/refmterr.nix
@@ -3,7 +3,7 @@
 {
   pname = "refmterr";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix b/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix
index 6e8b41bbd1c..8a7080f624d 100644
--- a/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix
+++ b/pkgs/development/ocaml-modules/reason-native/rely-junit-reporter.nix
@@ -3,9 +3,12 @@
 {
   pname = "rely-junit-reporter";
 
+  nativeBuildInputs = [
+    reason
+  ];
+
   buildInputs = [
     atdgen
-    reason
   ];
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/ocaml-modules/reason-native/rely.nix b/pkgs/development/ocaml-modules/reason-native/rely.nix
index a2230426bec..f29565f9c46 100644
--- a/pkgs/development/ocaml-modules/reason-native/rely.nix
+++ b/pkgs/development/ocaml-modules/reason-native/rely.nix
@@ -3,7 +3,7 @@
 {
   pname = "rely";
 
-  buildInputs = [
+  nativeBuildInputs = [
     reason
   ];
 
diff --git a/pkgs/development/ocaml-modules/rope/default.nix b/pkgs/development/ocaml-modules/rope/default.nix
index 9410ab21ea3..9ac090a780e 100644
--- a/pkgs/development/ocaml-modules/rope/default.nix
+++ b/pkgs/development/ocaml-modules/rope/default.nix
@@ -6,7 +6,7 @@ let param =
     version = "0.6.2";
     url = "https://github.com/Chris00/ocaml-rope/releases/download/${version}/rope-${version}.tbz";
     sha256 = "15cvfa0s1vjx7gjd07d3fkznilishqf4z4h2q5f20wm9ysjh2h2i";
-    buildInputs = [ dune_2 ];
+    nativeBuildInputs = [ dune_2 ];
     extra = {
       buildPhase = "dune build -p rope";
       installPhase = ''
@@ -17,7 +17,7 @@ let param =
     version = "0.5";
     url = "https://forge.ocamlcore.org/frs/download.php/1156/rope-0.5.tar.gz";
     sha256 = "05fr2f5ch2rqhyaj06rv5218sbg99p1m9pq5sklk04hpslxig21f";
-    buildInputs = [ ocamlbuild ];
+    nativeBuildInputs = [ ocamlbuild ];
     extra = { createFindlibDestdir = true; };
   };
 in
@@ -30,7 +30,10 @@ stdenv.mkDerivation ({
     inherit (param) url sha256;
   };
 
-  buildInputs = [ ocaml findlib benchmark ] ++ param.buildInputs;
+  nativeBuildInputs = [ ocaml findlib ] ++ param.nativeBuildInputs;
+  buildInputs = [ benchmark ] ;
+
+  strictDeps = true;
 
   meta = {
     homepage = "http://rope.forge.ocamlcore.org/";
diff --git a/pkgs/development/ocaml-modules/rresult/default.nix b/pkgs/development/ocaml-modules/rresult/default.nix
index 1198ca957f0..cdc3a1dba68 100644
--- a/pkgs/development/ocaml-modules/rresult/default.nix
+++ b/pkgs/development/ocaml-modules/rresult/default.nix
@@ -8,10 +8,13 @@ stdenv.mkDerivation rec {
     sha256 = "1k69a3gvrk7f2cshwjzvk7818f0bwxhacgd14wxy6d4gmrggci86";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
 
   propagatedBuildInputs = [ result ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/sawja/default.nix b/pkgs/development/ocaml-modules/sawja/default.nix
index 284ba97b9c7..3b0878155a5 100644
--- a/pkgs/development/ocaml-modules/sawja/default.nix
+++ b/pkgs/development/ocaml-modules/sawja/default.nix
@@ -23,9 +23,9 @@ stdenv.mkDerivation {
     sha256 = "sha256:0k51rscs9mdgpg3qn4cahql5ncdvlb207m015hr8v6r1vfgn0ddq";
   };
 
-  nativeBuildInputs = [ which ];
+  nativeBuildInputs = [ which ocaml findlib ];
 
-  buildInputs = [ ocaml findlib ];
+  strictDeps = true;
 
   patches = [ ./configure.sh.patch ./Makefile.config.example.patch ];
 
diff --git a/pkgs/development/ocaml-modules/sedlex/default.nix b/pkgs/development/ocaml-modules/sedlex/default.nix
index c1ea56b5c50..b808145bcbb 100644
--- a/pkgs/development/ocaml-modules/sedlex/default.nix
+++ b/pkgs/development/ocaml-modules/sedlex/default.nix
@@ -15,10 +15,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-VhzlDTYBFXgKWT69PqZYLuHkiaDwzhmyX2XfaqzHFl4=";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
 
   propagatedBuildInputs = [ gen ocaml-migrate-parsetree ppx_tools_versioned ];
 
+  strictDeps = true;
+
   buildFlags = [ "all" "opt" ];
 
   createFindlibDestdir = true;
diff --git a/pkgs/development/ocaml-modules/sha/default.nix b/pkgs/development/ocaml-modules/sha/default.nix
index c1a76e4149e..4cbb658b654 100644
--- a/pkgs/development/ocaml-modules/sha/default.nix
+++ b/pkgs/development/ocaml-modules/sha/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchurl, buildDunePackage, stdlib-shims, ounit }:
+{ lib, fetchurl, buildDunePackage, stdlib-shims, dune-configurator, ounit }:
 
 buildDunePackage rec {
   pname = "sha";
@@ -11,6 +11,8 @@ buildDunePackage rec {
 
   useDune2 = true;
 
+  buildInputs = [ dune-configurator ];
+
   propagatedBuildInputs = [
     stdlib-shims
   ];
diff --git a/pkgs/development/ocaml-modules/sodium/default.nix b/pkgs/development/ocaml-modules/sodium/default.nix
index cff3d6186d1..040a34ef6f1 100644
--- a/pkgs/development/ocaml-modules/sodium/default.nix
+++ b/pkgs/development/ocaml-modules/sodium/default.nix
@@ -16,9 +16,11 @@ stdenv.mkDerivation rec {
     ./lib-gen-link-bigarray.patch
   ];
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
   propagatedBuildInputs = [ ctypes libsodium ];
 
+  strictDeps = true;
+
   createFindlibDestdir = true;
 
   hardeningDisable = lib.optional stdenv.isDarwin "strictoverflow";
diff --git a/pkgs/development/ocaml-modules/sosa/default.nix b/pkgs/development/ocaml-modules/sosa/default.nix
index 1605a15bea8..141e2a50193 100644
--- a/pkgs/development/ocaml-modules/sosa/default.nix
+++ b/pkgs/development/ocaml-modules/sosa/default.nix
@@ -17,7 +17,9 @@ stdenv.mkDerivation rec {
     sha256 = "053hdv6ww0q4mivajj4iyp7krfvgq8zajq9d8x4mia4lid7j0dyk";
   };
 
-  buildInputs = [ ocaml ocamlbuild findlib ];
+  nativeBuildInputs = [ ocaml ocamlbuild findlib ];
+
+  strictDeps = true;
 
   buildPhase = "make build";
 
diff --git a/pkgs/development/ocaml-modules/sqlite3EZ/default.nix b/pkgs/development/ocaml-modules/sqlite3EZ/default.nix
index 02a281740b9..6009eaecce1 100644
--- a/pkgs/development/ocaml-modules/sqlite3EZ/default.nix
+++ b/pkgs/development/ocaml-modules/sqlite3EZ/default.nix
@@ -17,10 +17,13 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-pKysvth0efxJeyJQY2Dnqarg7OtsKyyLnFV/1ZhsfDY=";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild twt ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ twt ];
 
   propagatedBuildInputs = [ ocaml_sqlite3 ];
 
+  strictDeps = true;
+
   createFindlibDestdir = true;
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/stdcompat/default.nix b/pkgs/development/ocaml-modules/stdcompat/default.nix
index 0f3b5377fc5..eae9b264ba1 100644
--- a/pkgs/development/ocaml-modules/stdcompat/default.nix
+++ b/pkgs/development/ocaml-modules/stdcompat/default.nix
@@ -11,7 +11,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:01y67rndjlzfp5zq0gbqpg9skqq2hfbvhbq9lfhhk5xidr98sfj8";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
+
   # build fails otherwise
   enableParallelBuilding = false;
 
diff --git a/pkgs/development/ocaml-modules/tezos/legacy-store.nix b/pkgs/development/ocaml-modules/tezos/legacy-store.nix
index 6029401e361..b6d9f20df3c 100644
--- a/pkgs/development/ocaml-modules/tezos/legacy-store.nix
+++ b/pkgs/development/ocaml-modules/tezos/legacy-store.nix
@@ -23,10 +23,12 @@ buildDunePackage {
     lwt-watcher
   ];
 
-  buildInputs = [
+  nativeBuildInputs = [
     tezos-protocol-compiler
   ];
 
+  strictDeps = true;
+
   checkInputs = [
     alcotest-lwt
   ];
diff --git a/pkgs/development/ocaml-modules/tezos/lmdb.nix b/pkgs/development/ocaml-modules/tezos/lmdb.nix
index 6eaed942317..5b5690707ab 100644
--- a/pkgs/development/ocaml-modules/tezos/lmdb.nix
+++ b/pkgs/development/ocaml-modules/tezos/lmdb.nix
@@ -25,7 +25,7 @@ buildDunePackage {
 
   useDune2 = true;
 
-  buildInputs = [
+  nativeBuildInputs = [
     pkg-config
   ];
 
@@ -34,6 +34,8 @@ buildDunePackage {
     lmdb
   ];
 
+  strictDeps = true;
+
   checkInputs = [
     cstruct
     alcotest
diff --git a/pkgs/development/ocaml-modules/tezos/protocol-010-PtGRANAD.nix b/pkgs/development/ocaml-modules/tezos/protocol-010-PtGRANAD.nix
index 2321245220f..85dc33dc98f 100644
--- a/pkgs/development/ocaml-modules/tezos/protocol-010-PtGRANAD.nix
+++ b/pkgs/development/ocaml-modules/tezos/protocol-010-PtGRANAD.nix
@@ -2,6 +2,7 @@
 , buildDunePackage
 , tezos-stdlib
 , tezos-protocol-compiler
+, tezos-protocol-environment
 }:
 
 buildDunePackage {
@@ -9,10 +10,16 @@ buildDunePackage {
   inherit (tezos-stdlib) version useDune2;
   src = "${tezos-stdlib.base_src}/src";
 
-  buildInputs = [
+  nativeBuildInputs = [
     tezos-protocol-compiler
   ];
 
+  buildInputs = [
+    tezos-protocol-environment
+  ];
+
+  strictDeps = true;
+
   doCheck = true;
 
   meta = tezos-stdlib.meta // {
diff --git a/pkgs/development/ocaml-modules/tezos/protocol-011-PtHangz2.nix b/pkgs/development/ocaml-modules/tezos/protocol-011-PtHangz2.nix
index 2dec6085177..3cfb8cced04 100644
--- a/pkgs/development/ocaml-modules/tezos/protocol-011-PtHangz2.nix
+++ b/pkgs/development/ocaml-modules/tezos/protocol-011-PtHangz2.nix
@@ -2,6 +2,7 @@
 , buildDunePackage
 , tezos-stdlib
 , tezos-protocol-compiler
+, tezos-protocol-environment
 }:
 
 buildDunePackage {
@@ -9,10 +10,16 @@ buildDunePackage {
   inherit (tezos-stdlib) version useDune2;
   src = "${tezos-stdlib.base_src}/src";
 
-  buildInputs = [
+  nativeBuildInputs = [
     tezos-protocol-compiler
   ];
 
+  buildInputs = [
+    tezos-protocol-environment
+  ];
+
+  strictDeps = true;
+
   doCheck = true;
 
   meta = tezos-stdlib.meta // {
diff --git a/pkgs/development/ocaml-modules/tezos/store.nix b/pkgs/development/ocaml-modules/tezos/store.nix
index 69dad751270..3fbe945d07b 100644
--- a/pkgs/development/ocaml-modules/tezos/store.nix
+++ b/pkgs/development/ocaml-modules/tezos/store.nix
@@ -31,10 +31,12 @@ buildDunePackage {
     tezos-legacy-store
   ];
 
-  buildInputs = [
+  nativeBuildInputs = [
     tezos-protocol-compiler
   ];
 
+  strictDeps = true;
+
   checkInputs = [
     alcotest-lwt
   ];
diff --git a/pkgs/development/ocaml-modules/tezos/validation.nix b/pkgs/development/ocaml-modules/tezos/validation.nix
index b26b81f4a77..44a7576cc06 100644
--- a/pkgs/development/ocaml-modules/tezos/validation.nix
+++ b/pkgs/development/ocaml-modules/tezos/validation.nix
@@ -14,10 +14,12 @@ buildDunePackage {
     tezos-protocol-updater
   ];
 
-  buildInputs = [
+  nativeBuildInputs = [
     tezos-protocol-compiler
   ];
 
+  strictDeps = true;
+
   doCheck = true;
 
   meta = tezos-stdlib.meta // {
diff --git a/pkgs/development/ocaml-modules/toml/default.nix b/pkgs/development/ocaml-modules/toml/default.nix
index 6980a148e10..dd765e38823 100644
--- a/pkgs/development/ocaml-modules/toml/default.nix
+++ b/pkgs/development/ocaml-modules/toml/default.nix
@@ -15,7 +15,7 @@ buildDunePackage rec {
     sha256 = "08ywzqckllvwawl1wpgg7qzvx6jhq7d6vysa0d5hj7qdwq213ggm";
   };
 
-  buildInputs = [ menhir ];
+  nativeBuildInputs = [ menhir ];
   propagatedBuildInputs = [ iso8601 ];
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/topkg/default.nix b/pkgs/development/ocaml-modules/topkg/default.nix
index 9e1369a8567..10104228c83 100644
--- a/pkgs/development/ocaml-modules/topkg/default.nix
+++ b/pkgs/development/ocaml-modules/topkg/default.nix
@@ -38,6 +38,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ ocaml findlib ocamlbuild ];
   propagatedBuildInputs = param.propagatedBuildInputs or [];
 
+  strictDeps = true;
+
   buildPhase = "${run} build";
   createFindlibDestdir = true;
   installPhase = "${opaline}/bin/opaline -prefix $out -libdir $OCAMLFIND_DESTDIR";
diff --git a/pkgs/development/ocaml-modules/tsdl/default.nix b/pkgs/development/ocaml-modules/tsdl/default.nix
index 7c09e8cd9d7..a56cccbe071 100644
--- a/pkgs/development/ocaml-modules/tsdl/default.nix
+++ b/pkgs/development/ocaml-modules/tsdl/default.nix
@@ -18,8 +18,8 @@ stdenv.mkDerivation {
     sha256 = "1zwv0ixkigh1gzk5n49rwvz2f2m62jdkkqg40j7dclg4gri7691f";
   };
 
-  nativeBuildInputs = [ pkg-config ];
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ pkg-config ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
   propagatedBuildInputs = [ SDL2 ctypes ];
 
   preConfigure = ''
diff --git a/pkgs/development/ocaml-modules/twt/default.nix b/pkgs/development/ocaml-modules/twt/default.nix
index 407601c7a46..4e76f0c16d3 100644
--- a/pkgs/development/ocaml-modules/twt/default.nix
+++ b/pkgs/development/ocaml-modules/twt/default.nix
@@ -11,7 +11,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-xbjLPd7P1KyuC3i6WHLBcdLwd14atcBsd5ER+l97KAk=";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   preInstall = ''
     mkdir -p $out/bin
diff --git a/pkgs/development/ocaml-modules/type_conv/108.08.00.nix b/pkgs/development/ocaml-modules/type_conv/108.08.00.nix
index 337874e11a9..fb3977223f7 100644
--- a/pkgs/development/ocaml-modules/type_conv/108.08.00.nix
+++ b/pkgs/development/ocaml-modules/type_conv/108.08.00.nix
@@ -13,7 +13,10 @@ stdenv.mkDerivation rec {
     sha256 = "08ysikwwp69zvc147lzzg79nwlrzrk738rj0ggcfadi8h5il42sl";
   };
 
-  buildInputs = [ ocaml findlib camlp4 ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/type_conv/109.60.01.nix b/pkgs/development/ocaml-modules/type_conv/109.60.01.nix
index 4ec160a9223..1f6500c6ed1 100644
--- a/pkgs/development/ocaml-modules/type_conv/109.60.01.nix
+++ b/pkgs/development/ocaml-modules/type_conv/109.60.01.nix
@@ -15,7 +15,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-8Oz/fPL3+RghyxQp5u6seSEdf0BgfP6XNcsMYty0rNs=";
   };
 
-  buildInputs = [ ocaml findlib camlp4 ];
+  nativeBuildInputs = [ ocaml findlib ];
+  buildInputs = [ camlp4 ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/type_conv/112.01.01.nix b/pkgs/development/ocaml-modules/type_conv/112.01.01.nix
index e90ca2d16a6..468b872ec3d 100644
--- a/pkgs/development/ocaml-modules/type_conv/112.01.01.nix
+++ b/pkgs/development/ocaml-modules/type_conv/112.01.01.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, buildOcaml}:
+{ lib, fetchFromGitHub, buildOcaml, camlp4}:
 
 buildOcaml rec {
   minimumSupportedOcamlVersion = "4.02";
@@ -13,6 +13,10 @@ buildOcaml rec {
     sha256 = "sha256-HzH0hnceCQ2kDRATjl+tfKk3XSBDsGnPzVUGYpDQUmU=";
   };
 
+  strictDeps = true;
+
+  buildInputs = [ camlp4 ];
+
   meta = {
     homepage = "https://github.com/janestreet/type_conv/";
     description = "Support library for preprocessor type conversions";
diff --git a/pkgs/development/ocaml-modules/uchar/default.nix b/pkgs/development/ocaml-modules/uchar/default.nix
index 7d7d87af853..09004e8a943 100644
--- a/pkgs/development/ocaml-modules/uchar/default.nix
+++ b/pkgs/development/ocaml-modules/uchar/default.nix
@@ -10,7 +10,9 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ ocaml ocamlbuild findlib ];
-  buildInputs = [ findlib ocaml ocamlbuild ];
+
+  strictDeps = true;
+
   buildPhase = "ocaml pkg/build.ml native=true native-dynlink=${lib.boolToString withShared}";
   installPhase = "${opaline}/bin/opaline -libdir $OCAMLFIND_DESTDIR";
   configurePlatforms = [ ];
diff --git a/pkgs/development/ocaml-modules/ulex/default.nix b/pkgs/development/ocaml-modules/ulex/default.nix
index f1ada5d0998..9a5848db3f7 100644
--- a/pkgs/development/ocaml-modules/ulex/default.nix
+++ b/pkgs/development/ocaml-modules/ulex/default.nix
@@ -25,8 +25,9 @@ stdenv.mkDerivation rec {
 
   createFindlibDestdir = true;
 
-  buildInputs = [ ocaml findlib ocamlbuild ];
-  propagatedBuildInputs = [ camlp4 ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild camlp4 ];
+
+  strictDeps = true;
 
   buildFlags = [ "all" "all.opt" ];
 
diff --git a/pkgs/development/ocaml-modules/uucd/default.nix b/pkgs/development/ocaml-modules/uucd/default.nix
index 244f3f36dc3..0c71ddf0d70 100644
--- a/pkgs/development/ocaml-modules/uucd/default.nix
+++ b/pkgs/development/ocaml-modules/uucd/default.nix
@@ -13,7 +13,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:0fc737v5gj3339jx4x9xr096lxrpwvp6vaiylhavcvsglcwbgm30";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
+
+  strictDeps = true;
 
   inherit (topkg) buildPhase installPhase;
 
diff --git a/pkgs/development/ocaml-modules/uucp/default.nix b/pkgs/development/ocaml-modules/uucp/default.nix
index 2e8a360d455..9031087f505 100644
--- a/pkgs/development/ocaml-modules/uucp/default.nix
+++ b/pkgs/development/ocaml-modules/uucp/default.nix
@@ -21,10 +21,13 @@ stdenv.mkDerivation {
     sha256 = "sha256:1yx9nih3d9prb9zizq8fzmmqylf24a6yifhf81h33znrj5xn1mpj";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg uutf uunf ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg uutf uunf uucd ];
 
   propagatedBuildInputs = [ uchar ];
 
+  strictDeps = true;
+
   buildPhase = ''
     runHook preBuild
     ${topkg.buildPhase} --with-cmdliner false --tests ${lib.boolToString doCheck}
diff --git a/pkgs/development/ocaml-modules/uuidm/default.nix b/pkgs/development/ocaml-modules/uuidm/default.nix
index b260a05505b..336d66cb0a6 100644
--- a/pkgs/development/ocaml-modules/uuidm/default.nix
+++ b/pkgs/development/ocaml-modules/uuidm/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "1ivxb3hxn9bk62rmixx6px4fvn52s4yr1bpla7rgkcn8981v45r8";
   };
 
-  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
   configurePlatforms = [];
   buildInputs = [ topkg cmdliner ];
 
diff --git a/pkgs/development/ocaml-modules/uunf/default.nix b/pkgs/development/ocaml-modules/uunf/default.nix
index 073e6865fcd..12031c53927 100644
--- a/pkgs/development/ocaml-modules/uunf/default.nix
+++ b/pkgs/development/ocaml-modules/uunf/default.nix
@@ -18,10 +18,13 @@ stdenv.mkDerivation {
     sha256 = "sha256:17wv0nm3vvwcbzb1b09akw8jblmigyhbfmh1sy9lkb5756ni94a2";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg uutf cmdliner ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg uutf cmdliner ];
 
   propagatedBuildInputs = [ uchar ];
 
+  strictDeps = true;
+
   prePatch = lib.optionalString stdenv.isAarch64 "ulimit -s 16384";
 
   inherit (topkg) buildPhase installPhase;
diff --git a/pkgs/development/ocaml-modules/uuseg/default.nix b/pkgs/development/ocaml-modules/uuseg/default.nix
index 1fbcb57f3a6..42642d2dc24 100644
--- a/pkgs/development/ocaml-modules/uuseg/default.nix
+++ b/pkgs/development/ocaml-modules/uuseg/default.nix
@@ -15,9 +15,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256:1g9zyzjkhqxgbb9mh3cgaawscwdazv6y8kdqvmy6yhnimmfqv25p";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild cmdliner topkg uutf ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [  topkg cmdliner  uutf ];
   propagatedBuildInputs = [ uucp ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/uutf/default.nix b/pkgs/development/ocaml-modules/uutf/default.nix
index e8179e369af..6701c865051 100644
--- a/pkgs/development/ocaml-modules/uutf/default.nix
+++ b/pkgs/development/ocaml-modules/uutf/default.nix
@@ -13,10 +13,12 @@ stdenv.mkDerivation rec {
     sha256 = "1nx1rly3qj23jzn9yk3x6fwqimcxjd84kv5859vvhdg56psq26p6";
   };
 
-  nativeBuildInputs = [ ocaml ocamlbuild findlib ];
-  buildInputs = [ findlib topkg cmdliner ];
+  nativeBuildInputs = [ ocaml ocamlbuild findlib topkg ];
+  buildInputs = [ topkg cmdliner ];
   propagatedBuildInputs = [ uchar ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = with lib; {
diff --git a/pkgs/development/ocaml-modules/uuuu/default.nix b/pkgs/development/ocaml-modules/uuuu/default.nix
index 7d2eaac181d..4f400d1ec75 100644
--- a/pkgs/development/ocaml-modules/uuuu/default.nix
+++ b/pkgs/development/ocaml-modules/uuuu/default.nix
@@ -24,10 +24,12 @@ buildDunePackage rec {
 
   useDune2 = true;
 
-  nativeBuildInputs = [ menhir ];
+  nativeBuildInputs = [ menhir findlib ];
 
   buildInputs = [ angstrom ];
 
+  strictDeps = !doCheck;
+
   checkInputs = [ re ];
   doCheck = true;
 
diff --git a/pkgs/development/ocaml-modules/vg/default.nix b/pkgs/development/ocaml-modules/vg/default.nix
index a9a4c0d3d6b..9dc7a4eeeef 100644
--- a/pkgs/development/ocaml-modules/vg/default.nix
+++ b/pkgs/development/ocaml-modules/vg/default.nix
@@ -28,12 +28,15 @@ stdenv.mkDerivation {
     sha256 = "181sz6l5xrj5jvwg4m2yqsjzwp2s5h8v0mwhjcwbam90kdfx2nak";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild ];
+  buildInputs = [ topkg ];
 
   propagatedBuildInputs = [ uchar result gg ]
                           ++ optionals pdfBackend [ uutf otfm ]
                           ++ optionals htmlcBackend [ js_of_ocaml js_of_ocaml-ppx ];
 
+  strictDeps = true;
+
   buildPhase = topkg.buildPhase
     + " --with-uutf ${boolToString pdfBackend}"
     + " --with-otfm ${boolToString pdfBackend}"
diff --git a/pkgs/development/ocaml-modules/webbrowser/default.nix b/pkgs/development/ocaml-modules/webbrowser/default.nix
index 6a21a1e1f75..a8adced9388 100644
--- a/pkgs/development/ocaml-modules/webbrowser/default.nix
+++ b/pkgs/development/ocaml-modules/webbrowser/default.nix
@@ -11,9 +11,11 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
-  buildInputs = [];
+  buildInputs = [ topkg ];
   propagatedBuildInputs = [ astring bos cmdliner rresult ];
 
+  strictDeps = true;
+
   inherit (topkg) buildPhase installPhase;
 
   meta = {
diff --git a/pkgs/development/ocaml-modules/xml-light/default.nix b/pkgs/development/ocaml-modules/xml-light/default.nix
index 683d2ec214f..8eb700a4d14 100644
--- a/pkgs/development/ocaml-modules/xml-light/default.nix
+++ b/pkgs/development/ocaml-modules/xml-light/default.nix
@@ -11,7 +11,9 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-2txmkl/ZN5RGaLQJmr+orqwB4CbFk2RpLJd4gr7kPiE=";
   };
 
-  buildInputs = [ ocaml findlib ];
+  nativeBuildInputs = [ ocaml findlib ];
+
+  strictDeps = true;
 
   createFindlibDestdir = true;
 
diff --git a/pkgs/development/ocaml-modules/xmlm/default.nix b/pkgs/development/ocaml-modules/xmlm/default.nix
index 43b0bf5faa7..f7aa1fdf113 100644
--- a/pkgs/development/ocaml-modules/xmlm/default.nix
+++ b/pkgs/development/ocaml-modules/xmlm/default.nix
@@ -17,7 +17,10 @@ stdenv.mkDerivation rec {
     sha256 = "1rrdxg5kh9zaqmgapy9bhdqyxbbvxxib3bdfg1vhw4rrkp1z0x8n";
   };
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg ];
+  nativeBuildInputs = [ ocaml findlib ocamlbuild topkg ];
+  buildInputs = [ topkg ];
+
+  strictDeps = true;
 
   inherit (topkg) buildPhase installPhase;
 
diff --git a/pkgs/development/ocaml-modules/z3/default.nix b/pkgs/development/ocaml-modules/z3/default.nix
index 43fc5b245c8..b17f29b4353 100644
--- a/pkgs/development/ocaml-modules/z3/default.nix
+++ b/pkgs/development/ocaml-modules/z3/default.nix
@@ -29,9 +29,11 @@ stdenv.mkDerivation {
     runHook postInstall
   '';
 
-  buildInputs = [ findlib ];
+  nativeBuildInputs = [ findlib ];
   propagatedBuildInputs = [ zarith ];
 
+  strictDeps = true;
+
   meta = z3.meta // {
     description = "Z3 Theorem Prover (OCaml API)";
   };
diff --git a/pkgs/development/python-modules/APScheduler/default.nix b/pkgs/development/python-modules/APScheduler/default.nix
index 52d4ecdc3b7..9ba564fcaac 100644
--- a/pkgs/development/python-modules/APScheduler/default.nix
+++ b/pkgs/development/python-modules/APScheduler/default.nix
@@ -18,7 +18,7 @@
 
 buildPythonPackage rec {
   pname = "apscheduler";
-  version = "3.8.1";
+  version = "3.9.0.post1";
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
@@ -26,7 +26,7 @@ buildPythonPackage rec {
   src = fetchPypi {
     pname = "APScheduler";
     inherit version;
-    hash = "sha256-XPNE68+9qkiuF4wCnAVc7HvHpKR8IeMV5NHwi9NfI1U=";
+    hash = "sha256-I22/ckQgD/x5xsC5/30u0Q5+mF839I1KI/QUL0ln3LU=";
   };
 
   buildInputs = [
diff --git a/pkgs/development/python-modules/aiogithubapi/default.nix b/pkgs/development/python-modules/aiogithubapi/default.nix
index 747aa3f4d47..82c1145f9e3 100644
--- a/pkgs/development/python-modules/aiogithubapi/default.nix
+++ b/pkgs/development/python-modules/aiogithubapi/default.nix
@@ -12,7 +12,7 @@
 
 buildPythonPackage rec {
   pname = "aiogithubapi";
-  version = "22.2.3";
+  version = "22.2.4";
   format = "setuptools";
 
   disabled = pythonOlder "3.8";
@@ -21,7 +21,7 @@ buildPythonPackage rec {
     owner = "ludeeus";
     repo = pname;
     rev = version;
-    sha256 = "sha256-oeUcyClTmOYF6vdhwiOp2L7x27DXEbujdtRV4NwGcYo=";
+    sha256 = "sha256-2RYpeyX88+eEilK/wLDJ6Ock1JBgIUPWbm/ZBJSQ2pg=";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/celery/default.nix b/pkgs/development/python-modules/celery/default.nix
index eabb3521416..247d25bf420 100644
--- a/pkgs/development/python-modules/celery/default.nix
+++ b/pkgs/development/python-modules/celery/default.nix
@@ -19,6 +19,7 @@
 , pythonOlder
 , pytz
 , vine
+, nixosTests
 }:
 
 buildPythonPackage rec {
@@ -78,6 +79,10 @@ buildPythonPackage rec {
     "celery"
   ];
 
+  passthru.tests = {
+    inherit (nixosTests) sourcehut;
+  };
+
   meta = with lib; {
     description = "Distributed task queue";
     homepage = "https://github.com/celery/celery/";
diff --git a/pkgs/development/python-modules/django-dynamic-preferences/default.nix b/pkgs/development/python-modules/django-dynamic-preferences/default.nix
index 9f04f25f464..c9a0f10947e 100644
--- a/pkgs/development/python-modules/django-dynamic-preferences/default.nix
+++ b/pkgs/development/python-modules/django-dynamic-preferences/default.nix
@@ -4,11 +4,11 @@
 
 buildPythonPackage rec {
   pname = "django-dynamic-preferences";
-  version = "1.11.0";
+  version = "1.12.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "f214c938b5872a17647e2b2ccfd9ad00a90a3c6c4aa83fa65d3c5c446e7a66c7";
+    sha256 = "sha256-zYmHz45N024BmtPoolxYm8S0EMpKZs38vlwlpRenwK0=";
   };
 
   propagatedBuildInputs = [ six django persisting-theory ];
diff --git a/pkgs/development/python-modules/fontparts/default.nix b/pkgs/development/python-modules/fontparts/default.nix
index 7c04c54d424..7830cb11712 100644
--- a/pkgs/development/python-modules/fontparts/default.nix
+++ b/pkgs/development/python-modules/fontparts/default.nix
@@ -6,11 +6,11 @@
 
 buildPythonPackage rec {
   pname = "fontParts";
-  version = "0.10.2";
+  version = "0.10.3";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "a3a3926e977f82ae19e6823760b59f2338085973da1eaad5badaf969f261a737";
+    sha256 = "sha256-aHtjLHdc2/s3ppF8fz8qFAqxwEKMZJJAFNlBaZ7FAb4=";
     extension = "zip";
   };
 
diff --git a/pkgs/development/python-modules/hg-evolve/default.nix b/pkgs/development/python-modules/hg-evolve/default.nix
index 27c2167ff1d..9b1264e738b 100644
--- a/pkgs/development/python-modules/hg-evolve/default.nix
+++ b/pkgs/development/python-modules/hg-evolve/default.nix
@@ -6,11 +6,11 @@
 
 buildPythonPackage rec {
   pname = "hg-evolve";
-  version = "10.4.1";
+  version = "10.5.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "b47d9a1e0af3d7b54edd646581ac3e3ab046a572368eeb22dfd89dff7f9964d2";
+    sha256 = "sha256-p2zPUCc+KrsNxPChdW3ZgkOo+HJB7IcYtqh5Uh0Qnaw=";
   };
 
   checkInputs = [
diff --git a/pkgs/development/python-modules/ipython/default.nix b/pkgs/development/python-modules/ipython/default.nix
index c1c0b049dc8..29e8627a7df 100644
--- a/pkgs/development/python-modules/ipython/default.nix
+++ b/pkgs/development/python-modules/ipython/default.nix
@@ -26,7 +26,7 @@
 , testpath
 }:
 
-buildPythonPackage rec {
+buildPythonPackage (rec {
   pname = "ipython";
   version = "8.0.1";
   format = "pyproject";
@@ -87,4 +87,8 @@ buildPythonPackage rec {
     license = licenses.bsd3;
     maintainers = with maintainers; [ bjornfor fridh ];
   };
-}
+} // lib.optionalAttrs stdenv.isDarwin {
+  disabledTests = [
+    "test_clipboard_get" # uses pbpaste
+  ];
+})
diff --git a/pkgs/development/python-modules/pyamg/default.nix b/pkgs/development/python-modules/pyamg/default.nix
index 59e807f11fc..b2a230685cc 100644
--- a/pkgs/development/python-modules/pyamg/default.nix
+++ b/pkgs/development/python-modules/pyamg/default.nix
@@ -10,11 +10,11 @@
 
 buildPythonPackage rec {
   pname = "pyamg";
-  version = "4.2.1";
+  version = "4.2.2";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "48d9be622049d8363cda84125c45d18b89e0ab7d99be5a93c0246f375ebad344";
+    sha256 = "sha256-mtrFqUwEustYlCcCiV1FQZm7dJKohu650xHdiNg6D6E=";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/development/python-modules/python-izone/default.nix b/pkgs/development/python-modules/python-izone/default.nix
index f1f8be9d3d2..e3ce4310972 100644
--- a/pkgs/development/python-modules/python-izone/default.nix
+++ b/pkgs/development/python-modules/python-izone/default.nix
@@ -11,7 +11,7 @@
 
 buildPythonPackage rec {
   pname = "python-izone";
-  version = "1.2.4";
+  version = "1.2.7";
   format = "setuptools";
 
   disabled = pythonOlder "3.8";
@@ -20,7 +20,7 @@ buildPythonPackage rec {
     owner = "Swamp-Ig";
     repo = "pizone";
     rev = "v${version}";
-    hash = "sha256-HV8aQlwJ7VbGlJU0HpS9fK/QnRfYrk4ijKTGPWj0Jww=";
+    hash = "sha256-CvFOhs56dfNerK3junWElQfTJi1YXA86zMbv0tseQC8=";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/readability-lxml/default.nix b/pkgs/development/python-modules/readability-lxml/default.nix
new file mode 100644
index 00000000000..e012bf75fe5
--- /dev/null
+++ b/pkgs/development/python-modules/readability-lxml/default.nix
@@ -0,0 +1,33 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytestCheckHook
+, chardet
+, cssselect
+, lxml
+}:
+
+buildPythonPackage rec {
+  pname = "readability-lxml";
+  version = "0.8.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-5R/qVrWQmq+IbTB9SOeeCWKTJVr6Vnt9CLypTSWxpOE=";
+  };
+
+  propagatedBuildInputs = [ chardet cssselect lxml ];
+
+  postPatch = ''
+    substituteInPlace setup.py --replace 'sys.platform == "darwin"' "False"
+  '';
+
+  doCheck = false;
+
+  meta = with lib; {
+    description = "Fast python port of arc90's readability tool";
+    homepage = "https://github.com/buriy/python-readability";
+    license = licenses.apsl20;
+    maintainers = with maintainers; [ siraben ];
+  };
+}
diff --git a/pkgs/development/python-modules/rpyc/default.nix b/pkgs/development/python-modules/rpyc/default.nix
index 61a2f1e7560..a8849fd17cd 100644
--- a/pkgs/development/python-modules/rpyc/default.nix
+++ b/pkgs/development/python-modules/rpyc/default.nix
@@ -8,7 +8,7 @@
 
 buildPythonPackage rec {
   pname = "rpyc";
-  version = "5.0.1";
+  version = "5.1.0";
   format = "setuptools";
 
   disabled = pythonOlder "3.6";
@@ -17,7 +17,7 @@ buildPythonPackage rec {
     owner = "tomerfiliba";
     repo = pname;
     rev = version;
-    sha256 = "1g75k4valfjgab00xri4pf8c8bb2zxkhgkpyy44fjk7s5j66daa1";
+    sha256 = "sha256-Xeot4QEgTZjvdO0ydmKjccp6zwC93Yp/HkRlSgyDf8k=";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/weconnect-mqtt/default.nix b/pkgs/development/python-modules/weconnect-mqtt/default.nix
index 82bf024c824..42a3877cffc 100644
--- a/pkgs/development/python-modules/weconnect-mqtt/default.nix
+++ b/pkgs/development/python-modules/weconnect-mqtt/default.nix
@@ -4,12 +4,13 @@
 , pytestCheckHook
 , pythonOlder
 , paho-mqtt
+, python-dateutil
 , weconnect
 }:
 
 buildPythonPackage rec {
   pname = "weconnect-mqtt";
-  version = "0.29.1";
+  version = "0.30.0";
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
@@ -18,11 +19,12 @@ buildPythonPackage rec {
     owner = "tillsteinbach";
     repo = "WeConnect-mqtt";
     rev = "v${version}";
-    sha256 = "sha256-/hFlH0naE62d2dyYIJD/+TuSQDOVgS8tQsSX8JuReC0=";
+    sha256 = "sha256-/mlN9gEEy8DJSFef0Pp2PLjHhwStKwANKSzw4nT19eM=";
   };
 
   propagatedBuildInputs = [
     paho-mqtt
+    python-dateutil
     weconnect
   ];
 
diff --git a/pkgs/development/python-modules/weconnect/default.nix b/pkgs/development/python-modules/weconnect/default.nix
index 794fde43167..f5af3e5aa50 100644
--- a/pkgs/development/python-modules/weconnect/default.nix
+++ b/pkgs/development/python-modules/weconnect/default.nix
@@ -12,7 +12,7 @@
 
 buildPythonPackage rec {
   pname = "weconnect";
-  version = "0.36.4";
+  version = "0.37.0";
   format = "setuptools";
 
   disabled = pythonOlder "3.7";
@@ -21,7 +21,7 @@ buildPythonPackage rec {
     owner = "tillsteinbach";
     repo = "WeConnect-python";
     rev = "v${version}";
-    sha256 = "sha256-B4RZftGngV85Trm0iPj50WAv1M0H+sjQ9ABiGh070/M=";
+    sha256 = "sha256-h6jKtQt9vCh5bnhIqWLniUIJ41GxCs0uSi4vBVNs8tE=";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/tools/ocaml/camlidl/default.nix b/pkgs/development/tools/ocaml/camlidl/default.nix
index 1c3da92273c..5c3153a8849 100644
--- a/pkgs/development/tools/ocaml/camlidl/default.nix
+++ b/pkgs/development/tools/ocaml/camlidl/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "0483cs66zsxsavcllpw1qqvyhxb39ddil3h72clcd69g7fyxazl5";
   };
 
-  buildInputs = [ ocaml ];
+  nativeBuildInputs = [ ocaml ];
 
   # build fails otherwise
   enableParallelBuilding = false;
diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix
index 831360cd858..2d030b2d156 100644
--- a/pkgs/development/tools/ocaml/merlin/4.x.nix
+++ b/pkgs/development/tools/ocaml/merlin/4.x.nix
@@ -57,11 +57,19 @@ buildDunePackage {
 
   useDune2 = true;
 
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    menhir
+    jq
+  ];
   buildInputs = [
     dot-merlin-reader
     yojson
     csexp
     result
+    menhirSdk
+    menhirLib
   ];
 
   doCheck = true;
@@ -71,12 +79,6 @@ buildDunePackage {
     dune runtest # filtering with -p disables tests
     runHook postCheck
   '';
-  checkInputs = [
-    jq
-    menhir
-    menhirLib
-    menhirSdk
-  ];
 
   meta = with lib; {
     description = "An editor-independent tool to ease the development of programs in OCaml";
diff --git a/pkgs/development/tools/ocaml/merlin/default.nix b/pkgs/development/tools/ocaml/merlin/default.nix
index 1c9b549d612..3db5d137783 100644
--- a/pkgs/development/tools/ocaml/merlin/default.nix
+++ b/pkgs/development/tools/ocaml/merlin/default.nix
@@ -1,5 +1,5 @@
 { lib, fetchurl, buildDunePackage, substituteAll
-, dot-merlin-reader, dune_2, yojson, csexp, result }:
+, dot-merlin-reader, dune_2, yojson, csexp, result, menhirSdk }:
 
 buildDunePackage rec {
   pname = "merlin";
@@ -22,7 +22,9 @@ buildDunePackage rec {
     })
   ];
 
-  buildInputs = [ dot-merlin-reader yojson csexp result ];
+  strictDeps = true;
+
+  buildInputs = [ dot-merlin-reader yojson csexp result menhirSdk ];
 
   meta = with lib; {
     description = "An editor-independent tool to ease the development of programs in OCaml";
diff --git a/pkgs/development/tools/ocaml/oasis/default.nix b/pkgs/development/tools/ocaml/oasis/default.nix
index 10c7bf63aa4..d35ddbe210b 100644
--- a/pkgs/development/tools/ocaml/oasis/default.nix
+++ b/pkgs/development/tools/ocaml/oasis/default.nix
@@ -13,11 +13,15 @@ stdenv.mkDerivation {
 
   createFindlibDestdir = true;
 
-  buildInputs =
+  strictDeps = true;
+
+  nativeBuildInputs =
     [
       ocaml findlib ocamlbuild ocamlmod ocamlify
     ];
 
+  buildInputs = [ ocamlbuild ];
+
   configurePhase = ''
     runHook preConfigure
     ocaml setup.ml -configure --prefix $out
diff --git a/pkgs/development/tools/ocaml/obelisk/default.nix b/pkgs/development/tools/ocaml/obelisk/default.nix
index 0d92840a82b..a37a8c8b392 100644
--- a/pkgs/development/tools/ocaml/obelisk/default.nix
+++ b/pkgs/development/tools/ocaml/obelisk/default.nix
@@ -1,4 +1,4 @@
-{ lib, fetchFromGitHub, ocamlPackages }:
+{ lib, fetchFromGitHub, ocamlPackages, menhir }:
 
 ocamlPackages.buildDunePackage rec {
   pname = "obelisk";
@@ -11,7 +11,10 @@ ocamlPackages.buildDunePackage rec {
     sha256 = "1jjaqa2b7msl9qd3x7j34vdh1s9alq8hbvzk8a5srb4yyfyim15b";
   };
 
-  buildInputs = with ocamlPackages; [ menhir re ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ menhir ];
+  buildInputs = with ocamlPackages; [ re ];
 
   meta = {
     description = "A simple tool which produces pretty-printed output from a Menhir parser file (.mly)";
diff --git a/pkgs/development/tools/ocaml/ocamlformat/generic.nix b/pkgs/development/tools/ocaml/ocamlformat/generic.nix
index 5686e33f9b7..7cd3196317f 100644
--- a/pkgs/development/tools/ocaml/ocamlformat/generic.nix
+++ b/pkgs/development/tools/ocaml/ocamlformat/generic.nix
@@ -48,6 +48,12 @@ buildDunePackage {
 
   useDune2 = true;
 
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    menhir
+  ];
+
   buildInputs =
     if lib.versionAtLeast version "0.20.0"
     then [
@@ -57,7 +63,6 @@ buildDunePackage {
       either
       fix
       fpath
-      menhir
       menhirLib
       menhirSdk
       ocaml-version
@@ -78,7 +83,6 @@ buildDunePackage {
       uuseg
       uutf
       fix
-      menhir
       menhirLib
       menhirSdk
       ocp-indent
@@ -96,7 +100,6 @@ buildDunePackage {
       uuseg
       uutf
       fix
-      menhir
       menhirLib
       menhirSdk
       dune-build-info
@@ -115,7 +118,6 @@ buildDunePackage {
       uuseg
       uutf
       fix
-      menhir
       menhirLib
       menhirSdk
       dune-build-info
@@ -135,7 +137,6 @@ buildDunePackage {
       uuseg
       uutf
       fix
-      menhir
       menhirLib
       menhirSdk
       (ppxlib.override { version = "0.18.0"; })
@@ -154,7 +155,6 @@ buildDunePackage {
       uuseg
       uutf
       fix
-      menhir
       menhirLib
       menhirSdk
     ] else [
diff --git a/pkgs/development/tools/ocaml/ocp-index/default.nix b/pkgs/development/tools/ocaml/ocp-index/default.nix
index 716e2679a94..1ca8cfb5c52 100644
--- a/pkgs/development/tools/ocaml/ocp-index/default.nix
+++ b/pkgs/development/tools/ocaml/ocp-index/default.nix
@@ -13,7 +13,10 @@ buildDunePackage rec {
     sha256 = "120w72fqymjp6ibicbp31jyx9yv34mdvgkr0zdfpzvfb7lgd8rc7";
   };
 
-  buildInputs = [ cppo cmdliner re ];
+  strictDeps = true;
+
+  nativeBuildInputs = [ cppo ];
+  buildInputs = [ cmdliner re ];
 
   propagatedBuildInputs = [ ocp-indent ];
 
diff --git a/pkgs/development/tools/ocaml/utop/default.nix b/pkgs/development/tools/ocaml/utop/default.nix
index 913871314cf..a31b6f6f6f9 100644
--- a/pkgs/development/tools/ocaml/utop/default.nix
+++ b/pkgs/development/tools/ocaml/utop/default.nix
@@ -17,8 +17,7 @@ buildDunePackage rec {
     sha256 = "0mi571ifjzq4wcjarn8q1b7yl8nxjm1jfx3afac224lqwn6bhb2d";
   };
 
-  nativeBuildInputs = [ makeWrapper ];
-  buildInputs = [ cppo ];
+  nativeBuildInputs = [ makeWrapper cppo ];
 
   propagatedBuildInputs = [ lambdaTerm ];
 
diff --git a/pkgs/development/tools/omnisharp-roslyn/default.nix b/pkgs/development/tools/omnisharp-roslyn/default.nix
index 7fd1fff89d2..1099e7cc800 100644
--- a/pkgs/development/tools/omnisharp-roslyn/default.nix
+++ b/pkgs/development/tools/omnisharp-roslyn/default.nix
@@ -98,7 +98,7 @@ in stdenv.mkDerivation rec {
   meta = with lib; {
     description = "OmniSharp based on roslyn workspaces";
     homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     license = licenses.mit;
     maintainers = with maintainers; [ tesq0 ericdallo corngood ];
   };
diff --git a/pkgs/development/tools/scalafmt/default.nix b/pkgs/development/tools/scalafmt/default.nix
index ee49ee1bf6d..6a442424c4f 100644
--- a/pkgs/development/tools/scalafmt/default.nix
+++ b/pkgs/development/tools/scalafmt/default.nix
@@ -2,7 +2,7 @@
 
 let
   baseName = "scalafmt";
-  version = "3.4.0";
+  version = "3.4.3";
   deps = stdenv.mkDerivation {
     name = "${baseName}-deps-${version}";
     buildCommand = ''
@@ -13,7 +13,7 @@ let
     '';
     outputHashMode = "recursive";
     outputHashAlgo = "sha256";
-    outputHash     = "l5F09bjRev2eBHKTMzojC7+USkW7qf3YtA2KSoN7MxM=";
+    outputHash     = "FWGvhKK/VnvetnHS35/z1errYTRZCrcfWyEAHlhKApk=";
   };
 in
 stdenv.mkDerivation {