mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 08:16:14 +02:00
Merge branch 'nixpkgs#bashInteractive' of https://github.com/mkenigs/nix into flakes
This commit is contained in:
commit
04fb4e8a0f
3 changed files with 35 additions and 6 deletions
|
@ -303,12 +303,13 @@ struct CmdDevShell : Common, MixEnvironment
|
||||||
|
|
||||||
stopProgressBar();
|
stopProgressBar();
|
||||||
|
|
||||||
auto shell = getEnv("SHELL").value_or("bash");
|
|
||||||
|
|
||||||
setEnviron();
|
setEnviron();
|
||||||
// prevent garbage collection until shell exits
|
// prevent garbage collection until shell exits
|
||||||
setenv("NIX_GCROOT", gcroot.data(), 1);
|
setenv("NIX_GCROOT", gcroot.data(), 1);
|
||||||
|
|
||||||
|
auto state = getEvalState();
|
||||||
|
auto bashInstallable = std::make_shared<InstallableFlake>(state, std::move(installable->nixpkgsFlakeRef()), Strings{"bashInteractive"}, Strings{"legacyPackages." + settings.thisSystem.get() + "."}, lockFlags);
|
||||||
|
auto shell = state->store->printStorePath(toStorePath(state->store, Build, bashInstallable)) + "/bin/bash";
|
||||||
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
|
auto args = Strings{std::string(baseNameOf(shell)), "--rcfile", rcFilePath};
|
||||||
|
|
||||||
restoreAffinity();
|
restoreAffinity();
|
||||||
|
|
|
@ -408,8 +408,7 @@ ref<eval_cache::EvalCache> openEvalCache(
|
||||||
std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableFlake::toDerivation()
|
std::tuple<std::string, FlakeRef, InstallableValue::DerivationInfo> InstallableFlake::toDerivation()
|
||||||
{
|
{
|
||||||
|
|
||||||
auto lockedFlake = std::make_shared<flake::LockedFlake>(
|
auto lockedFlake = getLockedFlake();
|
||||||
lockFlake(*state, flakeRef, lockFlags));
|
|
||||||
|
|
||||||
auto cache = openEvalCache(*state, lockedFlake, true);
|
auto cache = openEvalCache(*state, lockedFlake, true);
|
||||||
auto root = cache->getRoot();
|
auto root = cache->getRoot();
|
||||||
|
@ -455,9 +454,9 @@ std::vector<InstallableValue::DerivationInfo> InstallableFlake::toDerivations()
|
||||||
|
|
||||||
std::pair<Value *, Pos> InstallableFlake::toValue(EvalState & state)
|
std::pair<Value *, Pos> InstallableFlake::toValue(EvalState & state)
|
||||||
{
|
{
|
||||||
auto lockedFlake = lockFlake(state, flakeRef, lockFlags);
|
auto lockedFlake = getLockedFlake();
|
||||||
|
|
||||||
auto vOutputs = getFlakeOutputs(state, lockedFlake);
|
auto vOutputs = getFlakeOutputs(state, *lockedFlake);
|
||||||
|
|
||||||
auto emptyArgs = state.allocBindings(0);
|
auto emptyArgs = state.allocBindings(0);
|
||||||
|
|
||||||
|
@ -493,6 +492,25 @@ InstallableFlake::getCursor(EvalState & state, bool useEvalCache)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<flake::LockedFlake> InstallableFlake::getLockedFlake() const
|
||||||
|
{
|
||||||
|
if (!_lockedFlake)
|
||||||
|
_lockedFlake = std::make_shared<flake::LockedFlake>(lockFlake(*state, flakeRef, lockFlags));
|
||||||
|
return _lockedFlake;
|
||||||
|
}
|
||||||
|
|
||||||
|
FlakeRef InstallableFlake::nixpkgsFlakeRef() const
|
||||||
|
{
|
||||||
|
auto lockedFlake = getLockedFlake();
|
||||||
|
|
||||||
|
auto nixpkgsInput = lockedFlake->flake.inputs.find("nixpkgs");
|
||||||
|
if (nixpkgsInput != lockedFlake->flake.inputs.end()) {
|
||||||
|
return std::move(nixpkgsInput->second.ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Installable::nixpkgsFlakeRef();
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
std::vector<std::shared_ptr<Installable>> SourceExprCommand::parseInstallables(
|
||||||
ref<Store> store, std::vector<std::string> ss)
|
ref<Store> store, std::vector<std::string> ss)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,6 +57,11 @@ struct Installable
|
||||||
|
|
||||||
virtual std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
virtual std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
||||||
getCursor(EvalState & state, bool useEvalCache);
|
getCursor(EvalState & state, bool useEvalCache);
|
||||||
|
|
||||||
|
virtual FlakeRef nixpkgsFlakeRef() const
|
||||||
|
{
|
||||||
|
return std::move(FlakeRef::fromAttrs({{"type","indirect"}, {"id", "nixpkgs"}}));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InstallableValue : Installable
|
struct InstallableValue : Installable
|
||||||
|
@ -83,6 +88,7 @@ struct InstallableFlake : InstallableValue
|
||||||
Strings attrPaths;
|
Strings attrPaths;
|
||||||
Strings prefixes;
|
Strings prefixes;
|
||||||
const flake::LockFlags & lockFlags;
|
const flake::LockFlags & lockFlags;
|
||||||
|
mutable std::shared_ptr<flake::LockedFlake> _lockedFlake;
|
||||||
|
|
||||||
InstallableFlake(ref<EvalState> state, FlakeRef && flakeRef,
|
InstallableFlake(ref<EvalState> state, FlakeRef && flakeRef,
|
||||||
Strings && attrPaths, Strings && prefixes, const flake::LockFlags & lockFlags)
|
Strings && attrPaths, Strings && prefixes, const flake::LockFlags & lockFlags)
|
||||||
|
@ -104,6 +110,10 @@ struct InstallableFlake : InstallableValue
|
||||||
|
|
||||||
std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
std::vector<std::pair<std::shared_ptr<eval_cache::AttrCursor>, std::string>>
|
||||||
getCursor(EvalState & state, bool useEvalCache) override;
|
getCursor(EvalState & state, bool useEvalCache) override;
|
||||||
|
|
||||||
|
std::shared_ptr<flake::LockedFlake> getLockedFlake() const;
|
||||||
|
|
||||||
|
FlakeRef nixpkgsFlakeRef() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
ref<eval_cache::EvalCache> openEvalCache(
|
ref<eval_cache::EvalCache> openEvalCache(
|
||||||
|
|
Loading…
Reference in a new issue