about summary refs log tree commit diff
path: root/src/nix-store
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index c182dbe49c7a..d7b998faebb7 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -64,15 +64,19 @@ static PathSet realisePath(const Path & path)
     if (isDerivation(path)) {
         store->buildPaths(singleton<PathSet>(path));
         Derivation drv = derivationFromPath(*store, path);
+        rootNr++;
 
         PathSet outputs;
         foreach (DerivationOutputs::iterator, i, drv.outputs) {
             Path outPath = i->second.path;
             if (gcRoot == "")
                 printGCWarning();
-            else
-                outPath = addPermRoot(*store, outPath,
-                    makeRootName(gcRoot, rootNr), indirectRoot);
+            else {
+                Path rootName = gcRoot;
+                if (rootNr > 1) rootName += "-" + int2String(rootNr);
+                if (i->first != "out") rootName += "-" + i->first;
+                outPath = addPermRoot(*store, outPath, rootName, indirectRoot);
+            }
             outputs.insert(outPath);
         }
         return outputs;