Clang / LD cannot find libclang_rt which comes from another package

I keep getting the following error when running cmake:

/nix/store/9xqfvjgwwik8qabj43vzbf5scmmr1k2a-clang-18.1.3/bin/clang-18  -fsanitize=address,undefined -pthread -ldl -lrt -lcurl -stdlib=libc++ CMakeFiles/cmTC_59160.dir/testCCompiler.c.o -o cmTC_59160   && :
    /nix/store/hqvni28zpibl6jsqqimcvng6h6qm58xy-binutils-2.41/bin/ld: cannot find /nix/store/9xqfvjgwwik8qabj43vzbf5scmmr1k2a-clang-18.1.3/lib/clang/18/lib/linux/libclang_rt.asan_static-x86_64.a: No such file or directory

It’s looking within the Clang directory for this lib, but the lib is actually located at:

/nix/store/4rizsdz26g0yjnwgp28v46xkdi2jahq7-compiler-rt-libc-18.1.3/lib/linux/libclang_rt.asan_static-x86_64.a

How do I let Clang or Ld see this library? I tried adding it to the LD_LIBRARY_PATH and LIBRARY_PATH env variables but that didn’t work:

{
  description = "A template for Nix based C++ project setup.";

  inputs = {
    # Pointing to the current stable release of nixpkgs. You can
    # customize this to point to an older version or unstable if you
    # like everything shining.
    #
    # E.g.
    #
    # nixpkgs.url = "github:NixOS/nixpkgs/unstable";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, ... }@inputs: inputs.utils.lib.eachSystem [
    # Add the system/architecture you would like to support here. Note that not
    # all packages in the official nixpkgs support all platforms.
    "x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin"
  ] (system: let
    pkgs = import nixpkgs {
      inherit system;
    };
  in {
    devShells.default = pkgs.mkShell rec {
      # Update the name to something that suites your project.
      name = "my-c++-project";

      packages = with pkgs; [
        # Development Tools
        llvmPackages_18.clang
        llvmPackages_18.compiler-rt-libc
        cmake
        ninja
        cowsay
        abseil-cpp
        xgboost
        gbenchmark
        libhv
        prometheus-cpp
        simdjson
        zlib

        # Development time dependencies
        gtest
      ];

      shellHook = let
        CXX = "clang++-18";
        CC = "clang-18";
        CMAKE_BUILD_TYPE = "Debug";
      in ''
        export CXX="${CXX}"
        export CC="${CC}"
        export CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
        export LD_LIBRARY_PATH=${pkgs.llvmPackages_18.compiler-rt-libc}/lib/linux
        export LIBRARY_PATH=${pkgs.llvmPackages_18.compiler-rt-libc}/lib/linux
      '';
    };
  });
}