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)
|
void updateLockFile(EvalState & state, std::string path)
|
||||||
{
|
{
|
||||||
// 'path' is the path to the local flake repo.
|
// '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)) {
|
if (std::get_if<FlakeRef::IsGit>(&flakeRef.data)) {
|
||||||
FlakeRegistry newLockFile = updateLockFile(state, flakeRef);
|
FlakeRegistry newLockFile = updateLockFile(state, flakeRef);
|
||||||
writeRegistry(newLockFile, path + "/flake.lock");
|
writeRegistry(newLockFile, path + "/flake.lock");
|
||||||
} else if (std::get_if<FlakeRef::IsGitHub>(&flakeRef.data)) {
|
} 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 {
|
} 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";
|
Path outLink = "result";
|
||||||
|
|
||||||
std::optional<std::string> flakeUri = std::nullopt;
|
std::optional<std::string> gitRepo = std::nullopt;
|
||||||
|
|
||||||
CmdBuild()
|
CmdBuild()
|
||||||
{
|
{
|
||||||
|
@ -28,9 +28,9 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
.set(&outLink, Path(""));
|
.set(&outLink, Path(""));
|
||||||
|
|
||||||
mkFlag()
|
mkFlag()
|
||||||
.longName("flake")
|
.longName("update-lock-file")
|
||||||
.description("update lock file of given flake")
|
.description("update the lock file")
|
||||||
.dest(&flakeUri);
|
.dest(&gitRepo);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name() override
|
std::string name() override
|
||||||
|
@ -78,9 +78,8 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flakeUri) {
|
if(gitRepo)
|
||||||
updateLockFile(*evalState, *flakeUri);
|
updateLockFile(*evalState, *gitRepo);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -34,15 +34,24 @@ struct Buildable
|
||||||
|
|
||||||
typedef std::vector<Buildable> Buildables;
|
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
|
struct FlakeCommand : virtual Args, StoreCommand, MixEvalArgs
|
||||||
{
|
{
|
||||||
std::string flakeUri;
|
std::string flakeUri;
|
||||||
|
|
||||||
public:
|
FlakeCommand()
|
||||||
FlakeCommand()
|
{
|
||||||
{
|
expectArg("flake-uri", &flakeUri);
|
||||||
expectArg("flake-uri", &flakeUri);
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Installable
|
struct Installable
|
||||||
|
|
|
@ -34,7 +34,7 @@ struct CmdFlakeList : StoreCommand, MixEvalArgs
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CmdFlakeUpdate : FlakeCommand
|
struct CmdFlakeUpdate : StoreCommand, GitRepoCommand, MixEvalArgs
|
||||||
{
|
{
|
||||||
std::string name() override
|
std::string name() override
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,12 @@ struct CmdFlakeUpdate : FlakeCommand
|
||||||
auto evalState = std::make_shared<EvalState>(searchPath, store);
|
auto evalState = std::make_shared<EvalState>(searchPath, store);
|
||||||
|
|
||||||
if (flakeUri == "") flakeUri = absPath("./flake.nix");
|
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;
|
j["description"] = flake.description;
|
||||||
std::cout << j.dump(4) << std::endl;
|
std::cout << j.dump(4) << std::endl;
|
||||||
} else {
|
} else {
|
||||||
std::cout << "Location: " << flake.path << "\n";
|
|
||||||
std::cout << "Description: " << flake.description << "\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;
|
PathSet pathsToBuild;
|
||||||
|
|
||||||
for (auto & i : installables) {
|
for (auto & i : installables) {
|
||||||
|
std::cout << i->what() << std::endl;
|
||||||
for (auto & b : i->toBuildables()) {
|
for (auto & b : i->toBuildables()) {
|
||||||
if (b.drvPath != "") {
|
if (b.drvPath != "") {
|
||||||
StringSet outputNames;
|
StringSet outputNames;
|
||||||
|
|
Loading…
Reference in a new issue