nixos-systems/modules/system/librechat/package.nix
Eli Ribble 27779f8256
Attempt to update librechat to the latest release candidate
This doesn't work, I fail to build with:

error: Cannot build '/nix/store/g6l9hkdpagw2bnmwahc02l52mkrffvgg-librechat-0.8.2-rc2.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/q4qgw0i8jwphy8zay91mc0ryn6dnrw94-librechat-0.8.2-rc2
       Last 25 log lines:
       > Running phase: patchPhase
       > applying patch /nix/store/bilh0c0cmfgnw2a7qn3dwxp71q2pl9ac-0001-npm-pack.patch
       > patching file package.json
       > applying patch /nix/store/0dk9z8sxk35dgwkfw0qsb1w683qw89yn-0002-logs.patch
       > patching file api/config/meiliLogger.js
       > patching file api/config/winston.js
       > applying patch /nix/store/h0m3hci4giadx23h8a47qwmabvz90s54-0003-upload-paths.patch
       > patching file api/config/paths.js
       > Executing npmConfigHook
       > Configuring npm
       > Validating consistency between /build/source/package-lock.json and /nix/store/sd3xvlghlw83aacmyqkxlcxvvxk3srad-librechat-0.8.2-rc2-npm-deps/package-lock.json
       > Making cache writable
       > Setting npm_config_cache to /build/cache
       > Installing dependencies
       > npm error code ENOTCACHED
       > npm error request to https://registry.npmjs.org/@testing-library%2freact failed: cache mode is 'only-if-cached' but no cached response is available.
       > npm error A complete log of this run can be found in: /build/cache/_logs/2026-01-13T16_43_25_772Z-debug-0.log
       >
       > ERROR: npm failed to install dependencies
       >
       > Here are a few things you can try, depending on the error:
       > 1. Set `makeCacheWritable = true`
       >   Note that this won't help if npm is complaining about not being able to write to the logs directory -- look above that for the actual error.
       > 2. Set `npmFlags = [ "--legacy-peer-deps" ]`
       >
       For full logs, run:
         nix log /nix/store/g6l9hkdpagw2bnmwahc02l52mkrffvgg-librechat-0.8.2-rc2.drv
error: Cannot build '/nix/store/mwicxm33crq9iv9gc3pkyns3dsfijvc4-system-path.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/kgm1vrr5vp07jswzqn9v70k8i8vq38i6-system-path
error: Cannot build '/nix/store/56ck3y67vqv06vjhi55smz2zcczch8rr-unit-librechat.service.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/1p3js87qgsdvdnfmisli6jwck474h4xj-unit-librechat.service
error: Cannot build '/nix/store/x6lmb98l84hjvrlvla1hrmqs7mjxndwn-nixos-system-nocix-amd-legacy-octacore-25.11.20260110.d030887.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/yd6x6a6grvahryrfazdd8xqmb7znmpfs-nixos-system-nocix-amd-legacy-octacore-25.11.20260110.d030887
2026-01-13 16:56:10 +00:00

73 lines
2 KiB
Nix

{
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";
};
}