attic/nix_store: Call initNix before connecting to store

Fixes #22.
This commit is contained in:
Zhaofeng Li 2023-02-04 13:28:47 -07:00
parent 97187894c2
commit 4ad6ce9309
3 changed files with 7 additions and 0 deletions

View file

@ -95,4 +95,9 @@ fn run_bindgen() {
.atleast_version("2.4") .atleast_version("2.4")
.probe("nix-store") .probe("nix-store")
.unwrap(); .unwrap();
pkg_config::Config::new()
.atleast_version("2.4")
.probe("nix-main")
.unwrap();
} }

View file

@ -76,6 +76,7 @@ RString CPathInfo::ca() {
CNixStore::CNixStore() { CNixStore::CNixStore() {
std::map<std::string, std::string> params; std::map<std::string, std::string> params;
nix::initNix();
this->store = nix::openStore("auto", params); this->store = nix::openStore("auto", params);
} }

View file

@ -19,6 +19,7 @@
#include <nix/hash.hh> #include <nix/hash.hh>
#include <nix/path.hh> #include <nix/path.hh>
#include <nix/serialise.hh> #include <nix/serialise.hh>
#include <nix/shared.hh>
#include <rust/cxx.h> #include <rust/cxx.h>
template<class T> using RVec = rust::Vec<T>; template<class T> using RVec = rust::Vec<T>;