forked from lix-project/lix
Fixed minor things
This commit is contained in:
parent
d4ee8afd59
commit
e007f367bd
|
@ -299,14 +299,14 @@ FlakeRegistry updateLockFile(EvalState & evalState, FlakeRef & flakeRef)
|
|||
void updateLockFile(EvalState & state, std::string path)
|
||||
{
|
||||
// 'path' is the path to the local flake repo.
|
||||
FlakeRef flakeRef = FlakeRef(path);
|
||||
FlakeRef flakeRef = FlakeRef("file://" + path);
|
||||
if (std::get_if<FlakeRef::IsGit>(&flakeRef.data)) {
|
||||
FlakeRegistry newLockFile = updateLockFile(state, flakeRef);
|
||||
writeRegistry(newLockFile, path + "/flake.lock");
|
||||
} else if (std::get_if<FlakeRef::IsGitHub>(&flakeRef.data)) {
|
||||
throw UsageError("You can only update local flakes, not flakes on GitHub.");
|
||||
throw UsageError("you can only update local flakes, not flakes on GitHub");
|
||||
} else {
|
||||
throw UsageError("You can only update local flakes, not flakes through their FlakeId.");
|
||||
throw UsageError("you can only update local flakes, not flakes through their FlakeId");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
|||
{
|
||||
Path outLink = "result";
|
||||
|
||||
std::optional<std::string> flakeUri = std::nullopt;
|
||||
std::optional<std::string> gitRepo = std::nullopt;
|
||||
|
||||
CmdBuild()
|
||||
{
|
||||
|
@ -28,9 +28,9 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
|||
.set(&outLink, Path(""));
|
||||
|
||||
mkFlag()
|
||||
.longName("flake")
|
||||
.description("update lock file of given flake")
|
||||
.dest(&flakeUri);
|
||||
.longName("update-lock-file")
|
||||
.description("update the lock file")
|
||||
.dest(&gitRepo);
|
||||
}
|
||||
|
||||
std::string name() override
|
||||
|
@ -78,9 +78,8 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
|||
}
|
||||
}
|
||||
|
||||
if (flakeUri) {
|
||||
updateLockFile(*evalState, *flakeUri);
|
||||
}
|
||||
if(gitRepo)
|
||||
updateLockFile(*evalState, *gitRepo);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -34,15 +34,24 @@ struct Buildable
|
|||
|
||||
typedef std::vector<Buildable> Buildables;
|
||||
|
||||
struct GitRepoCommand : virtual Args
|
||||
{
|
||||
std::string gitPath = absPath(".");
|
||||
|
||||
GitRepoCommand ()
|
||||
{
|
||||
expectArg("git-path", &gitPath, true);
|
||||
}
|
||||
};
|
||||
|
||||
struct FlakeCommand : virtual Args, StoreCommand, MixEvalArgs
|
||||
{
|
||||
std::string flakeUri;
|
||||
std::string flakeUri;
|
||||
|
||||
public:
|
||||
FlakeCommand()
|
||||
{
|
||||
expectArg("flake-uri", &flakeUri);
|
||||
}
|
||||
FlakeCommand()
|
||||
{
|
||||
expectArg("flake-uri", &flakeUri);
|
||||
}
|
||||
};
|
||||
|
||||
struct Installable
|
||||
|
|
|
@ -34,7 +34,7 @@ struct CmdFlakeList : StoreCommand, MixEvalArgs
|
|||
}
|
||||
};
|
||||
|
||||
struct CmdFlakeUpdate : FlakeCommand
|
||||
struct CmdFlakeUpdate : StoreCommand, GitRepoCommand, MixEvalArgs
|
||||
{
|
||||
std::string name() override
|
||||
{
|
||||
|
@ -51,7 +51,12 @@ struct CmdFlakeUpdate : FlakeCommand
|
|||
auto evalState = std::make_shared<EvalState>(searchPath, store);
|
||||
|
||||
if (flakeUri == "") flakeUri = absPath("./flake.nix");
|
||||
updateLockFile(*evalState, flakeUri);
|
||||
int result = updateLockFile(*evalState, flakeUri);
|
||||
if (result == 1) {
|
||||
std::cout << "You can only update local flakes, not flakes on GitHub.\n";
|
||||
} else if (result == 2) {
|
||||
std::cout << "You can only update local flakes, not flakes through their FlakeId.\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -77,8 +82,8 @@ struct CmdFlakeInfo : FlakeCommand, MixJSON
|
|||
j["description"] = flake.description;
|
||||
std::cout << j.dump(4) << std::endl;
|
||||
} else {
|
||||
std::cout << "Location: " << flake.path << "\n";
|
||||
std::cout << "Description: " << flake.description << "\n";
|
||||
std::cout << "Location: " << flake.path << "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -234,6 +234,7 @@ Buildables build(ref<Store> store, RealiseMode mode,
|
|||
PathSet pathsToBuild;
|
||||
|
||||
for (auto & i : installables) {
|
||||
std::cout << i->what() << std::endl;
|
||||
for (auto & b : i->toBuildables()) {
|
||||
if (b.drvPath != "") {
|
||||
StringSet outputNames;
|
||||
|
|
Loading…
Reference in a new issue