run.hh: Declare chrootHelper

Change-Id: I94c61e87a7649286c81f1716d60d5a85be876da2
This commit is contained in:
Rebecca Turner
2025-03-17 10:47:26 -07:00
parent 2a336813ad
commit aa135863fb
3 changed files with 14 additions and 17 deletions
+1 -4
View File
@@ -26,6 +26,7 @@
#include "nix-instantiate.hh"
#include "nix-store.hh"
#include "prefetch-command.hh"
#include "run.hh"
#include <sys/types.h>
#include <sys/socket.h>
@@ -35,10 +36,6 @@
#include <nlohmann/json.hpp>
extern std::string chrootHelperName;
void chrootHelper(int argc, char * * argv);
namespace nix {
void registerLegacyCommands()
+4 -7
View File
@@ -11,6 +11,7 @@
#include "lix/libexpr/eval.hh"
#include "lix/libstore/build/personality.hh"
#include "lix/libutil/current-process.hh"
#include "run.hh"
#if __linux__
#include "lix/libstore/temporary-dir.hh"
@@ -19,10 +20,6 @@
#include <queue>
using namespace nix;
std::string chrootHelperName = "__run_in_chroot";
namespace nix {
void runProgramInStore(ref<Store> store,
@@ -50,7 +47,7 @@ void runProgramInStore(ref<Store> store,
if (store->config().storeDir != store2->getRealStoreDir()) {
Strings helperArgs = {
chrootHelperName,
std::string(chrootHelperName),
store->config().storeDir,
store2->getRealStoreDir(),
std::string(system.value_or("")),
@@ -74,8 +71,6 @@ void runProgramInStore(ref<Store> store,
throw SysError("unable to execute '%s'", program);
}
}
struct CmdShell : InstallablesCommand, MixEnvironment
{
@@ -306,3 +301,5 @@ void chrootHelper(int argc, char * * argv)
throw Error("mounting the Nix store on '%s' is not supported on this platform", storeDir);
#endif
}
}
+9 -6
View File
@@ -5,15 +5,18 @@
namespace nix {
enum struct UseSearchPath {
Use,
DontUse
};
static constexpr std::string_view chrootHelperName = "__run_in_chroot";
void runProgramInStore(ref<Store> store,
void chrootHelper(int argc, char ** argv);
enum struct UseSearchPath { Use, DontUse };
void runProgramInStore(
ref<Store> store,
UseSearchPath useSearchPath,
const std::string & program,
const Strings & args,
std::optional<std::string_view> system = std::nullopt);
std::optional<std::string_view> system = std::nullopt
);
}