fix(nix-cache-server): patch nix-serve-ng for cppnix 2.30+ API drift - #312
fix(nix-cache-server): patch nix-serve-ng for cppnix 2.30+ API drift#312Joaqim wants to merge 1 commit into
Conversation
…e transform Three sed patches against cbits/nix.cpp covering the API drift between the nix-serve-ng-1.1.0 pin and cppnix 2.30+: - settings.nixStore is removed from the global Settings singleton; the store directory now lives on Store instances via StoreDirConfig::storeDir (store-dir-config.hh:33). Switch to getStore()->storeDir, which reuses the memoised store helper already used elsewhere in the file. - ValidPathInfo::sigs is now std::set<nix::Signature> (path-info.hh:105), not std::set<std::string>; project each Signature to its string form via Signature::to_string() (local-keys.hh:37). - SecretKey::signDetached now returns nix::Signature (local-keys.hh:78); append .to_string() at the call site. The single sed covers both the pre-Lix-2.94 and post-Lix-2.94 branches. Without these patches, vira's nix-cache-server fails to compile on hosts that build vira from source against cppnix 2.30+ rather than pulling prebuilt artifacts from cache.nixos.asia.
|
The three drifted call sites
The patchThree ${pkgs.gnused}/bin/sed -i 's|copyString(settings\.nixStore, output);|copyString(getStore()->storeDir, output);|' $out/cbits/nix.cpp
${pkgs.gnused}/bin/sed -i 's|std::vector<std::string> sigs(validPathInfo->sigs\.begin(), validPathInfo->sigs\.end());|std::vector<std::string> sigs; for (const auto \& s : validPathInfo->sigs) sigs.push_back(s.to_string());|' $out/cbits/nix.cpp
${pkgs.gnused}/bin/sed -i 's|signDetached(message);|signDetached(message).to_string();|' $out/cbits/nix.cppThe third sed catches both pre- and post-Lix-2.94 branches since they share the trailing pattern. Why this went undetected
Reproductionnix build github:Joaqim/vira/cppnix-2.30-api-compatVerified locally on cppnix 2.34.6: full build succeeds end-to-end, 3135-line build log shows zero error markers, produces Generated by Claude Code (model |
|
Thanks!
Given this, I wonder if there's a alternative or fork that is official-Nix friendly? |
|
By the way, I offered to contribute to upstream (so as to obviate mainaining this patch here), but so far they have not responded to me: aristanetworks/nix-serve-ng#48 |
|
Yes, your opened issue surfaced during diagnosis, I choose to follow your established solution with just patching downstream instead. |

No description provided.