mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 14:36:16 +02:00
Merge remote-tracking branch 'tweag/automatedUpdate' into flakes
This commit is contained in:
commit
a12cd53567
3 changed files with 22 additions and 7 deletions
|
@ -10,7 +10,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
{
|
{
|
||||||
Path outLink = "result";
|
Path outLink = "result";
|
||||||
|
|
||||||
bool updateLock = true;
|
bool update = true;
|
||||||
|
|
||||||
CmdBuild()
|
CmdBuild()
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
mkFlag()
|
mkFlag()
|
||||||
.longName("no-update")
|
.longName("no-update")
|
||||||
.description("don't update the lock file")
|
.description("don't update the lock file")
|
||||||
.set(&updateLock, false);
|
.set(&update, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name() override
|
std::string name() override
|
||||||
|
@ -77,11 +77,12 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FlakeUri flakeUri = "";
|
if (update)
|
||||||
// if(updateLock)
|
for (auto installable : installables) {
|
||||||
// for (uint i = 0; i < installables.size(); i++)
|
auto flakeUri = installable->installableToFlakeUri();
|
||||||
// // if (auto flakeUri = installableToFlakeUri)
|
if (flakeUri)
|
||||||
// updateLockFile(*evalState, flakeUri);
|
updateLockFile(*evalState, *flakeUri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "args.hh"
|
#include "args.hh"
|
||||||
#include "primops/flake.hh"
|
#include "primops/flake.hh"
|
||||||
#include "common-eval-args.hh"
|
#include "common-eval-args.hh"
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
namespace nix {
|
namespace nix {
|
||||||
|
|
||||||
|
@ -66,6 +67,11 @@ struct Installable
|
||||||
|
|
||||||
Buildable toBuildable();
|
Buildable toBuildable();
|
||||||
|
|
||||||
|
virtual std::optional<std::string> installableToFlakeUri()
|
||||||
|
{
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
|
||||||
virtual Value * toValue(EvalState & state)
|
virtual Value * toValue(EvalState & state)
|
||||||
{
|
{
|
||||||
throw Error("argument '%s' cannot be evaluated", what());
|
throw Error("argument '%s' cannot be evaluated", what());
|
||||||
|
|
|
@ -175,6 +175,14 @@ struct InstallableFlake : InstallableValue
|
||||||
state.forceValue(*v);
|
state.forceValue(*v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<std::string> installableToFlakeUri() override
|
||||||
|
{
|
||||||
|
if (std::get_if<FlakeRef::IsPath>(&flakeRef.data))
|
||||||
|
return flakeRef.to_string();
|
||||||
|
else
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: extend
|
// FIXME: extend
|
||||||
|
|
Loading…
Reference in a new issue