{
  config,
  pkgs,
  lib,
  ...
}: {
  nixpkgs.overlays = [
    (final: prev: {
      ollama-intel = prev.ollama.overrideAttrs (oldAttrs: {
        buildInputs =
          oldAttrs.buildInputs
          or []
          ++ [prev.intel-compute-runtime.drivers];
        propagatedBuildInputs =
          oldAttrs.propagetedBuildInputs
          or []
          ++ [prev.intel-compute-runtime.drivers];

        cmakeFlags = [
          "GGML_NATIVE=true"
          "BUILD_SHARED_LIBS=true"
          "GGML_BLAS=true"
          "GGML_SYCL=true"
          "GGML_SYCL_F16=false"
          "CMAKE_C_COMPILER=icx"
          "CMAKE_CXX_COMPILER=icpx"
        ];

        postInstall =
          (oldAttrs.postInstall or "")
          + ''
                   mkdir -p "$out/bin"
                   cat << EOF > "$out/bin/ollama-wrapped"
                   #!/bin/sh
                   export LD_LIBRARY_PATH="${prev.intel-compute-runtime.drivers}/lib"
                   export OLLAMA_INTEL_GPU=1
            export OLLAMA_NUM_GPU=999
            export ZES_ENABLE_SYSMAN=1
            export SYCL_CACHE_PERSISTENT=1
                   exec "$out/bin/ollama-base" "\$@"
                   EOF
                   chmod +x "$out/bin/ollama-wrapped"
                   mv $out/bin/ollama $out/bin/ollama-base
                   ln -s "$out/bin/ollama-wrapped" "$out/bin/ollama"
          '';
      });
    })
  ];
}
