Files
nixfiles/lib/json-c-runtime.nix
T
jackos1998 af32a8dd4b
Update docs / update (push) Successful in 1m28s
CI / Check, build and cache nixfiles (push) Failing after 1m31s
lib/json-c: Work around the 0.19 memory leak
In json-c 0.19, json_object_put calls the function that frees detached
JSON objects inside assert(). Release builds with NDEBUG skip that
call. Sway's frequent IPC replies then leak memory, eventually making
workspace switches lag.

Patching json-c in the main package set changes the library's store
path and forces dependent packages, including Firefox and Chromium,
to rebuild. Keep the pin with SPDK 26.09 and build the ABI-compatible
fix separately. Rewrite runtime references in NixOS systems and
standalone Home Manager generations to reuse their existing binaries.

Drop the replacement when the pinned nixpkgs includes the fix.

https://github.com/NixOS/nixpkgs/pull/586077
2026-11-23 17:09:05 +00:00

14 lines
600 B
Nix

{ lib, pkgs, pkgsFlake }:
# TODO: Drop this when updating the fork pin to a revision with the json-c fix.
# Patch the runtime library separately so existing consumers can be reused.
lib.optional ((pkgsFlake.rev or null) == "320600d55ff67365e933b98b339acdeac238eb26") {
oldDependency = pkgs.json_c;
newDependency = pkgs.json_c.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [ (pkgs.fetchpatch {
url = "https://github.com/json-c/json-c/commit/f291fa81c6f21d925ea771a8cca597f5886309cc.patch";
hash = "sha256-ZffSw1pfEfOH2ylRpJShdx7sTQR2nmPM/JIj/26UrDM=";
}) ];
});
}