lix/src/libexpr/get-drvs.hh
Eelco Dolstra 451dbf687f * nix-env now maintains meta info (from the `meta' derivation
attribute) about installed packages in user environments.  Thus, an
  operation like `nix-env -q --description' shows useful information
  not only on available packages but also on installed packages.

* nix-env now passes the entire manifest as an argument to the Nix
  expression of the user environment builder (not just a list of
  paths), so that in particular the user environment builder has
  access to the meta attributes.
  
* New operation `--set-flag' in nix-env to change meta info of
  installed packages.  This will be useful to pass per-package
  policies to the user environment builder (e.g., how to resolve
  collision or whether to disable a package (NIX-80)) or upgrade
  policies in nix-env (e.g., that a package should be "masked", that
  is, left untouched by upgrade actions).  Example:

  $ nix-env --set-flag enabled false ghc-6.4
2007-02-02 01:52:42 +00:00

68 lines
1.3 KiB
C++

#ifndef __GET_DRVS_H
#define __GET_DRVS_H
#include <string>
#include <map>
#include <boost/shared_ptr.hpp>
#include "eval.hh"
namespace nix {
typedef std::map<string, string> MetaInfo;
struct DrvInfo
{
private:
string drvPath;
string outPath;
public:
string name;
string attrPath; /* path towards the derivation */
string system;
/* !!! these should really be hidden, and setMetaInfo() should
make a copy since the ATermMap can be shared between multiple
DrvInfos. */
boost::shared_ptr<ATermMap> attrs;
string queryDrvPath(EvalState & state) const;
string queryOutPath(EvalState & state) const;
MetaInfo queryMetaInfo(EvalState & state) const;
void setDrvPath(const string & s)
{
drvPath = s;
}
void setOutPath(const string & s)
{
outPath = s;
}
void setMetaInfo(const MetaInfo & meta);
};
typedef list<DrvInfo> DrvInfos;
/* Evaluate expression `e'. If it evaluates to a derivation, store
information about the derivation in `drv' and return true.
Otherwise, return false. */
bool getDerivation(EvalState & state, Expr e, DrvInfo & drv);
void getDerivations(EvalState & state, Expr e, const string & pathPrefix,
const ATermMap & autoArgs, DrvInfos & drvs);
}
#endif /* !__GET_DRVS_H */