Unverified Commit afd96bad authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

Bump and fix nextjs-ollama-llm-ui (#347856)

parents 7971a492 f385d942
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ in

      ollamaUrl = lib.mkOption {
        type = lib.types.str;
        default = "127.0.0.1:11434";
        default = "http://127.0.0.1:11434";
        example = "https://ollama.example.org";
        description = ''
          The address (including host and port) under which we can access the Ollama backend server.
@@ -79,6 +79,7 @@ in
        serviceConfig = {
          ExecStart = "${lib.getExe nextjs-ollama-llm-ui}";
          DynamicUser = true;
          CacheDirectory = "nextjs-ollama-llm-ui";
        };
      };
    };
+0 −879

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −16
Original line number Diff line number Diff line
diff --git a/next.config.mjs b/next.config.mjs
index dc34f1a..f6f90c4 100644
--- a/next.config.mjs
+++ b/next.config.mjs
@@ -1,6 +1,7 @@
 /** @type {import('next').NextConfig} */
 const nextConfig = {
-    webpack: (config, { isServer }) => {
+  output: 'standalone',
+  webpack: (config, { isServer }) => {
         // Fixes npm packages that depend on `fs` module
         if (!isServer) {
           config.resolve.fallback = {
-- 
2.42.0
+6 −9
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
}:

let
  version = "1.0.1";
  version = "1.1.0";
in
buildNpmPackage {
  pname = "nextjs-ollama-llm-ui";
@@ -24,20 +24,14 @@ buildNpmPackage {
    owner = "jakobhoeg";
    repo = "nextjs-ollama-llm-ui";
    rev = "v${version}";
    hash = "sha256-pZJgiopm0VGwaZxsNcyRawevvzEcK1j5WhngX1Pn6YE=";
    hash = "sha256-IA7g96u5QY8cOuTbJEWw7+U+hSFBzIQVk4Kv3qHKAdM=";
  };
  npmDepsHash = "sha256-wtHOW0CyEOszgiZwDkF2/cSxbw6WFRLbhDnd2FlY70E=";
  npmDepsHash = "sha256-3M0BZ9KZZ0ONwvTLycfMR8skMQf8mzjeqYCwJY4l040=";

  patches = [
    # Update to a newer nextjs version that buildNpmPackage is able to build.
    # Remove at nextjs update.
    ./0001-update-nextjs.patch
    # nextjs tries to download google fonts from the internet during buildPhase and fails in Nix sandbox.
    # We patch the code to expect a local font from src/app/Inter.ttf that we load from Nixpkgs in preBuild phase.
    ./0002-use-local-google-fonts.patch
    # Modify next.config.js to produce a production "standalone" output at .next/standalone.
    # This output is easy to package with Nix and run with "node .next/standalone/server.js" later.
    ./0003-add-standalone-output.patch
  ];

  # Adjust buildNpmPackage phases with nextjs quirk workarounds.
@@ -70,6 +64,9 @@ buildNpmPackage {
    mkdir -p $out/share/homepage/.next
    cp -r .next/static $out/share/homepage/.next/static

    # https://github.com/vercel/next.js/discussions/58864
    ln -s /var/cache/nextjs-ollama-llm-ui $out/share/homepage/.next/cache

    chmod +x $out/share/homepage/server.js

    # we set a default port to support "nix run ..."