about summary refs log tree commit diff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-21T14·23+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-21T14·23+0000
commit06208d1d8677eaea1fb56dd09832f43154bbab5d (patch)
treea7e8ba6cb611048b5e35e9ad53a49554ed22a611 /src/nix-env
parent2e9042bd1e7e3a322f072f0bf98510698afa626a (diff)
* Uninstallation.
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/main.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nix-env/main.cc b/src/nix-env/main.cc
index c391fc13c06f..73166964fe9b 100644
--- a/src/nix-env/main.cc
+++ b/src/nix-env/main.cc
@@ -14,6 +14,7 @@ struct DrvInfo
     string name;
     Path drvPath;
     Path outPath;
+    Hash drvHash;
 };
 
 typedef map<Path, DrvInfo> DrvInfos;
@@ -36,6 +37,10 @@ bool parseDerivation(EvalState & state, Expr e, DrvInfo & drv)
     if (!a) throw badTerm("derivation path missing", e);
     drv.drvPath = evalPath(state, a);
 
+    a = queryAttr(e, "drvHash");
+    if (!a) throw badTerm("derivation hash missing", e);
+    drv.drvHash = parseHash(evalString(state, a));
+
     a = queryAttr(e, "outPath");
     if (!a) throw badTerm("output path missing", e);
     drv.outPath = evalPath(state, a);
@@ -169,10 +174,12 @@ void createUserEnv(EvalState & state, const DrvInfos & drvs)
             "Bind(\"type\", Str(\"derivation\")), "
             "Bind(\"name\", Str(<str>)), "
             "Bind(\"drvPath\", Path(<str>)), "
+            "Bind(\"drvHash\", Str(<str>)), "
             "Bind(\"outPath\", Path(<str>))"
             "])",
             i->second.name.c_str(),
             i->second.drvPath.c_str(),
+            ((string) i->second.drvHash).c_str(),
             i->second.outPath.c_str());
         inputs = ATinsert(inputs, t);
     }
@@ -280,12 +287,10 @@ void uninstallDerivations(EvalState & state, Strings drvNames)
         if (j == nameMap.end())
             throw Error(format("unknown derivation `%1%'") % *i);
         else
-            installedDrvs.erase(j->first);
+            installedDrvs.erase(j->second);
     }
 
    createUserEnv(state, installedDrvs);
-#if 0
-#endif
 }