From 4cf7bc285b240c2bc16f1787cfa658589e86d12d Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Tue, 13 Jan 2026 17:06:56 +0000 Subject: [PATCH] Switch to mainline maintained librechat I can't build my custom version anymore anyway. --- modules/system/librechat.nix | 8 +- modules/system/librechat/0001-npm-pack.patch | 21 ------ modules/system/librechat/0002-logs.patch | 26 ------- .../system/librechat/0003-upload-paths.patch | 20 ----- modules/system/librechat/package.nix | 73 ------------------- 5 files changed, 3 insertions(+), 145 deletions(-) delete mode 100644 modules/system/librechat/0001-npm-pack.patch delete mode 100644 modules/system/librechat/0002-logs.patch delete mode 100644 modules/system/librechat/0003-upload-paths.patch delete mode 100644 modules/system/librechat/package.nix diff --git a/modules/system/librechat.nix b/modules/system/librechat.nix index 48c4fc2..99f0be5 100644 --- a/modules/system/librechat.nix +++ b/modules/system/librechat.nix @@ -1,8 +1,5 @@ { lib, config, nixpkgs, pkgs, ... }: with lib; -let - librechat = (pkgs.callPackage (./librechat/package.nix ) { }); -in { options.myModules.librechat.enable = mkEnableOption "custom librechat configuration"; @@ -14,8 +11,9 @@ in group = "librechat"; }; environment.systemPackages = [ - librechat + pkgs.librechat pkgs.meilisearch + pkgs.mongodb-tools ]; services.caddy.virtualHosts."ai.gleipnir.technology".extraConfig = '' reverse_proxy http://localhost:10050 @@ -133,7 +131,7 @@ in Type = "simple"; User = "librechat"; Group = "librechat"; - ExecStart = "${librechat}/bin/librechat-server"; + ExecStart = "${pkgs.librechat}/bin/librechat-server"; TimeoutStopSec = "5s"; PrivateTmp = true; WorkingDirectory = "/opt/librechat"; diff --git a/modules/system/librechat/0001-npm-pack.patch b/modules/system/librechat/0001-npm-pack.patch deleted file mode 100644 index 2091b4e..0000000 --- a/modules/system/librechat/0001-npm-pack.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/package.json b/package.json -index 011551594..f4f98c1a8 100644 ---- a/package.json -+++ b/package.json -@@ -160,5 +160,16 @@ - "admin/", - "packages/" - ] -+ }, -+ "files": [ -+ "api", -+ "client/dist", -+ "config", -+ "packages/data-provider", -+ "packages/data-schemas", -+ "packages/mcp" -+ ], -+ "bin": { -+ "librechat-server": "api/server/index.js" - } - } diff --git a/modules/system/librechat/0002-logs.patch b/modules/system/librechat/0002-logs.patch deleted file mode 100644 index 32791ec..0000000 --- a/modules/system/librechat/0002-logs.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/api/config/meiliLogger.js b/api/config/meiliLogger.js -index 398672da5..fcd6864f8 100644 ---- a/api/config/meiliLogger.js -+++ b/api/config/meiliLogger.js -@@ -26,7 +26,7 @@ const getLogDir = () => { - } - - // Local development: use api/logs relative to this file -- return path.join(__dirname, '..', 'logs'); -+ return path.join('.', 'logs'); - }; - - const logDir = getLogDir(); -diff --git a/api/config/winston.js b/api/config/winston.js -index 93b84f7c4..4276bd6c2 100644 ---- a/api/config/winston.js -+++ b/api/config/winston.js -@@ -27,7 +27,7 @@ const getLogDir = () => { - } - - // Local development: use api/logs relative to this file -- return path.join(__dirname, '..', 'logs'); -+ return path.join('.', 'logs'); - }; - - const logDir = getLogDir(); diff --git a/modules/system/librechat/0003-upload-paths.patch b/modules/system/librechat/0003-upload-paths.patch deleted file mode 100644 index e941c04..0000000 --- a/modules/system/librechat/0003-upload-paths.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/api/config/paths.js b/api/config/paths.js -index 165e9e6..fc85083 100644 ---- a/api/config/paths.js -+++ b/api/config/paths.js -@@ -2,13 +2,13 @@ const path = require('path'); - - module.exports = { - root: path.resolve(__dirname, '..', '..'), -- uploads: path.resolve(__dirname, '..', '..', 'uploads'), -+ uploads: path.resolve('.', 'uploads'), - clientPath: path.resolve(__dirname, '..', '..', 'client'), - dist: path.resolve(__dirname, '..', '..', 'client', 'dist'), - publicPath: path.resolve(__dirname, '..', '..', 'client', 'public'), - fonts: path.resolve(__dirname, '..', '..', 'client', 'public', 'fonts'), - assets: path.resolve(__dirname, '..', '..', 'client', 'public', 'assets'), -- imageOutput: path.resolve(__dirname, '..', '..', 'client', 'public', 'images'), -+ imageOutput: path.resolve('.', 'images'), - structuredTools: path.resolve(__dirname, '..', 'app', 'clients', 'tools', 'structured'), - pluginManifest: path.resolve(__dirname, '..', 'app', 'clients', 'tools', 'manifest.json'), - }; diff --git a/modules/system/librechat/package.nix b/modules/system/librechat/package.nix deleted file mode 100644 index 5a403f9..0000000 --- a/modules/system/librechat/package.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ - lib, - buildNpmPackage, - fetchFromGitHub, - pkg-config, - node-gyp, - vips, - nix-update-script, -}: - -buildNpmPackage rec { - pname = "librechat"; - version = "0.8.2-rc2"; - - src = fetchFromGitHub { - owner = "danny-avila"; - repo = "LibreChat"; - tag = "v${version}"; - hash = "sha256-3H+ixVnamGYjSYHsn9f4IpY1834bXIJxs8am+vPi6I0="; - }; - - patches = [ - # `buildNpmPackage` relies on `npm pack`, which only includes files explicitly - # listed in the project's package.json `files` array if this property is set. - # LibreChat does not set this property, but we can avoid packaging the whole - # workspace by simply adding the relevant paths here ourselves. - # Also, we set the `bin` property to the server script to benefit from the - # auto-generated wrapper. - ./0001-npm-pack.patch - # LibreChat tries writing logs to the package directory, which is immutable - # in our case. We patch the log directory to target the current working directory - # instead, which in case of NixOS will be the service's data directory. - ./0002-logs.patch - # Similarly to the logs, user uploads are by default written to the package - # directory as well. Again, we patch this to be relative to the current working - # directory instead. - ./0003-upload-paths.patch - ]; - - npmDepsHash = "sha256-3Q9FCyGCYcMQ1Vab2W2PFNBre6BYtx7DLKRY0G351N0="; - - nativeBuildInputs = [ - pkg-config - node-gyp - ]; - - buildInputs = [ - vips - ]; - - # required for sharp - makeCacheWritable = true; - - npmBuildScript = "frontend"; - npmPruneFlags = [ "--omit=dev" ]; - - passthru = { - updateScript = nix-update-script { - extraArgs = [ - "--version-regex" - "^v(\\d+\\.\\d+\\.\\d+)$" - ]; - }; - }; - - meta = { - description = "Open-source app for all your AI conversations, fully customizable and compatible with any AI provider"; - homepage = "https://github.com/danny-avila/LibreChat"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ niklaskorz ]; - mainProgram = "librechat-server"; - }; -}