1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-13 14:02:42 +01:00

nix: Make -f work for compatibility

This commit is contained in:
Eelco Dolstra 2019-04-08 16:11:17 +02:00
parent 9b7eac332b
commit 101d964a59
4 changed files with 61 additions and 91 deletions

View file

@ -74,23 +74,20 @@ struct Installable
struct SourceExprCommand : virtual Args, StoreCommand, MixEvalArgs
{
std::optional<Path> file;
std::optional<std::string> flakeUri;
SourceExprCommand();
/* Return a value representing the Nix expression from which we
are installing. This is either the file specified by --file,
or an attribute set constructed from $NIX_PATH, e.g. { nixpkgs
= import ...; bla = import ...; }. */
Value * getSourceExpr(EvalState & state);
ref<EvalState> getEvalState();
std::vector<std::shared_ptr<Installable>> parseInstallables(
ref<Store> store, std::vector<std::string> ss);
std::shared_ptr<Installable> parseInstallable(
ref<Store> store, const std::string & installable);
private:
std::shared_ptr<EvalState> evalState;
Value * vSourceExpr = 0;
};
enum RealiseMode { Build, NoBuild, DryRun };
@ -108,8 +105,6 @@ struct InstallablesCommand : virtual Args, SourceExprCommand
void prepare() override;
virtual bool useDefaultInstallables() { return true; }
private:
std::vector<std::string> _installables;
@ -148,8 +143,6 @@ public:
virtual void run(ref<Store> store, Paths storePaths) = 0;
void run(ref<Store> store) override;
bool useDefaultInstallables() override { return !all; }
};
/* A command that operates on exactly one store path. */
@ -174,10 +167,6 @@ struct RegisterCommand
}
};
std::shared_ptr<Installable> parseInstallable(
SourceExprCommand & cmd, ref<Store> store, const std::string & installable,
bool useDefaultInstallables);
Buildables build(ref<Store> store, RealiseMode mode,
std::vector<std::shared_ptr<Installable>> installables);