1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 14:21:48 +02:00

Implement nix-copy-closure --from via nix-store --serve

This commit is contained in:
Eelco Dolstra 2014-07-24 16:00:29 +02:00
parent 62309a2c56
commit 03103c0a36
4 changed files with 23 additions and 30 deletions

View file

@ -993,9 +993,10 @@ static void opServe(Strings opFlags, Strings opArgs)
}
case cmdExportPaths: {
bool sign = readInt(in);
Paths sorted = topoSortPaths(*store, readStorePaths<PathSet>(in));
reverse(sorted.begin(), sorted.end());
exportPaths(*store, sorted, false, out);
exportPaths(*store, sorted, sign, out);
break;
}
@ -1025,6 +1026,16 @@ static void opServe(Strings opFlags, Strings opArgs)
break;
}
case cmdQueryClosure: {
bool includeOutputs = readInt(in);
PathSet paths = readStorePaths<PathSet>(in);
PathSet closure;
for (auto & i : paths)
computeFSClosure(*store, i, closure, false, includeOutputs);
writeStrings(closure, out);
break;
}
default:
throw Error(format("unknown serve command %1%") % cmd);
}

View file

@ -16,6 +16,7 @@ typedef enum {
cmdImportPaths = 4,
cmdExportPaths = 5,
cmdBuildPaths = 6,
cmdQueryClosure = 7,
} ServeCommand;
}