Unverified Commit c08ad8fa authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

gpt4all: 3.4.2 -> 3.9.0 (#372723)

parents 3a3f931f 192a5218
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  gitUpdater,
}:
stdenv.mkDerivation (finalAttrs: {
  pname = "duckx";
  version = "1.2.2";

  src = fetchFromGitHub {
    owner = "amiremohamadi";
    repo = "DuckX";
    tag = "v${finalAttrs.version}";
    hash = "sha256-qRqYcBi/a2tUSlLAa7DKPqwQsctw5/0hjV/Og1pHPQU=";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  cmakeFlags = [
    # https://github.com/amiremohamadi/DuckX/issues/92
    (lib.cmakeFeature "CMAKE_CXX_STANDARD" "14")
  ];

  passthru = {
    updateScript = gitUpdater { rev-prefix = "v"; };
  };

  meta = {
    description = "C++ library for creating and modifying Microsoft Word (.docx) files";
    homepage = "https://github.com/amiremohamadi/DuckX";
    changelog = "https://github.com/amiremohamadi/DuckX/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ titaniumtown ];
  };
})
+29 −17
Original line number Diff line number Diff line
@@ -4,10 +4,15 @@
  stdenv,
  fetchFromGitHub,
  fetchurl,
  fetchpatch,
  cmake,
  qt6,
  boost,
  fmt,
  duckx,
  expected-lite,
  optional-lite,
  string-view-lite,
  variant-lite,
  qt6,
  shaderc,
  vulkan-headers,
  wayland,
@@ -18,14 +23,14 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "gpt4all";
  version = "3.4.2";
  version = "3.9.0";

  src = fetchFromGitHub {
    fetchSubmodules = true;
    hash = "sha256-QzU22y6tt3UhazVSPcFuKejH4AV+mw7JExH61NtAKoM=";
    hash = "sha256-DbMoDdP7tEku3zZiCOmPz3iHQF5acg97gd+tLKoFu/o=";
    owner = "nomic-ai";
    repo = "gpt4all";
    rev = "v${finalAttrs.version}";
    tag = "v${finalAttrs.version}";
  };

  embed_model = fetchurl {
@@ -35,14 +40,13 @@ stdenv.mkDerivation (finalAttrs: {

  patches = [
    ./embedding-local.patch
    (fetchpatch {
      url = "https://aur.archlinux.org/cgit/aur.git/plain/004-fix-build-with-qt-6.8.0.diff?h=gpt4all-chat&id=d14b12cb63fae95e578aa839a570189a23833051";
      sha256 = "3Zur9KFn45f4dgAzOF7p1q42IdLqXwioN4zMiBbWbVU=";
      # remove the `gpt4all-chat` part of the paths as sourceRoot is gpt4all-chat
      stripLen = 1;
    })
  ];

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail "duckx::duckx QXlsx" "duckx QXlsx"
  '';

  sourceRoot = "${finalAttrs.src.name}/gpt4all-chat";

  nativeBuildInputs =
@@ -57,7 +61,13 @@ stdenv.mkDerivation (finalAttrs: {

  buildInputs =
    [
      expected-lite
      optional-lite
      string-view-lite
      variant-lite
      boost
      fmt
      duckx
      qt6.qtwayland
      qt6.qtquicktimeline
      qt6.qtsvg
@@ -80,14 +90,16 @@ stdenv.mkDerivation (finalAttrs: {

  cmakeFlags =
    [
      "-DKOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER=OFF"
      "-DKOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK=ON"
      "-DKOMPUTE_OPT_USE_BUILT_IN_FMT=OFF"
      "-DGGML_VULKAN=ON"
      "-DGGML_KOMPUTE=ON"
      (lib.cmakeBool "KOMPUTE_OPT_USE_BUILT_IN_VULKAN_HEADER" false)
      (lib.cmakeBool "KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK" true)
      (lib.cmakeBool "KOMPUTE_OPT_USE_BUILT_IN_FMT" false)

      # https://github.com/NixOS/nixpkgs/issues/298997
      # https://github.com/nomic-ai/gpt4all/issues/3468
      (lib.cmakeBool "LLMODEL_KOMPUTE" false)
    ]
    ++ lib.optionals (!cudaSupport) [
      "-DLLMODEL_CUDA=OFF"
      (lib.cmakeBool "LLMODEL_CUDA" false)
    ];

  postInstall = ''
+39 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "optional-lite";
  version = "3.6.0";

  src = fetchFromGitHub {
    owner = "martinmoene";
    repo = "optional-lite";
    tag = "v${finalAttrs.version}";
    hash = "sha256-qmKuxYc0cpoOtRRb4okJZ8pYPvzQid1iqBctnhGlz6M=";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  doCheck = true;

  passthru = {
    updateScript = gitUpdater { rev-prefix = "v"; };
  };

  meta = {
    description = "A C++17-like optional, a nullable object for C++98, C++11 and later in a single-file header-only library";
    homepage = "https://github.com/martinmoene/optional-lite";
    changelog = "https://github.com/martinmoene/optional-lite/blob/v${finalAttrs.version}/CHANGES.txt";
    license = lib.licenses.boost;
    maintainers = with lib.maintainers; [ titaniumtown ];
  };
})
+38 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "string-view-lite";
  version = "1.8.0";

  src = fetchFromGitHub {
    owner = "martinmoene";
    repo = "string-view-lite";
    tag = "v${finalAttrs.version}";
    hash = "sha256-hXm3MLskeZzTegSj79dQV+VcwBatT1VIAUydjisd19U=";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  doCheck = true;
  passthru = {
    updateScript = gitUpdater { rev-prefix = "v"; };
  };

  meta = {
    description = "A C++17-like string_view for C++98, C++11 and later in a single-file header-only library";
    homepage = "https://github.com/martinmoene/string-view-lite";
    changelog = "https://github.com/martinmoene/string-view-lite/blob/v${finalAttrs.version}/CHANGES.txt";
    license = lib.licenses.boost;
    maintainers = with lib.maintainers; [ titaniumtown ];
  };
})
+43 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  ninja,
  gitUpdater,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "variant-lite";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "martinmoene";
    repo = "variant-lite";
    tag = "v${finalAttrs.version}";
    hash = "sha256-zLyzNzeD0C4e7CYqCCsPzkqa2cH5pSbL9vNVIxdkEfc=";
  };

  nativeBuildInputs = [
    cmake
    ninja
  ];

  cmakeFlags = [
    # https://github.com/martinmoene/variant-lite/issues/50
    (lib.cmakeBool "VARIANT_LITE_OPT_BUILD_TESTS" false)
  ];

  doCheck = true;
  passthru = {
    updateScript = gitUpdater { rev-prefix = "v"; };
  };

  meta = {
    description = "A C++17-like variant, a type-safe union for C++98, C++11 and later in a single-file header-only library";
    homepage = "https://github.com/martinmoene/variant-lite";
    changelog = "https://github.com/martinmoene/variant-lite/blob/v${finalAttrs.version}/CHANGES.txt";
    license = lib.licenses.boost;
    maintainers = with lib.maintainers; [ titaniumtown ];
  };
})