about summary refs log tree commit diff
path: root/src/libexpr/get-drvs.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2007-02-02T01·52+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2007-02-02T01·52+0000
commit451dbf687f65b42d70e64c3858771abaab51b356 (patch)
tree2954eb3c33c2d3800ac1f4296d4c694613485079 /src/libexpr/get-drvs.cc
parentf52de527c7743d8fe28574f02b632566a1006244 (diff)
* 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


Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r--src/libexpr/get-drvs.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index ba9fbcd6df..bd0ec4781c 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -60,6 +60,16 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const
 }
 
 
+void DrvInfo::setMetaInfo(const MetaInfo & meta)
+{
+    ATermMap metaAttrs;
+    for (MetaInfo::const_iterator i = meta.begin(); i != meta.end(); ++i)
+        metaAttrs.set(toATerm(i->first),
+            makeAttrRHS(makeStr(i->second), makeNoPos()));
+    attrs->set(toATerm("meta"), makeAttrs(metaAttrs));
+}
+
+
 /* Cache for already evaluated derivations.  Usually putting ATerms in
    a STL container is unsafe (they're not scanning for GC roots), but
    here it doesn't matter; everything in this set is reachable from