Support Lix 2.92 (#42)

* Support Lix 2.92

nix-serve-ng can now build against lix by passing -f lix to cabal

the flake now also exports the `lix-serve-ng` package for a version that
is built against lix

* add back configureFlags, lost in rebase
This commit is contained in:
Zoe Zuser
2025-05-10 15:19:48 -04:00
committed by GitHub
parent 101b4a552f
commit d1b8a9a02f
5 changed files with 182 additions and 15 deletions

View File

@@ -1,9 +1,15 @@
#include <cstddef>
#include <cstdlib>
#include <nix/store/store-api.hh>
#include <nix/store/log-store.hh>
#include <nix/main/shared.hh>
#ifndef LIX
#include <nix/store/store-api.hh>
#include <nix/store/log-store.hh>
#include <nix/main/shared.hh>
#else
#include <lix/libstore/store-api.hh>
#include <lix/libstore/log-store.hh>
#include <lix/libmain/shared.hh>
#endif
#include "nix.hh"
@@ -17,7 +23,11 @@ static ref<Store> getStore()
static std::shared_ptr<Store> _store;
if (!_store) {
#ifndef LIX
initLibStore(true);
#else
initNix();
#endif
_store = openStore();
}
@@ -122,7 +132,11 @@ void queryPathInfo
output->deriver = emptyString;
};
#ifndef LIX
copyString(validPathInfo->narHash.to_string(nix::HashFormat::Nix32, true), &output->narHash);
#else
copyString(validPathInfo->narHash.to_string(nix::Base::Base32, true), &output->narHash);
#endif
output->narSize = validPathInfo->narSize;
@@ -185,7 +199,11 @@ bool dumpPath
});
try {
#ifndef LIX
store->narFromPath(storePath.value(), sink);
#else
sink << store->narFromPath(storePath.value());
#endif
} catch (const std::runtime_error & e) {
// Intentionally do nothing. We're only using the exception as a
// short-circuiting mechanism.