diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-12T22·25-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-07-12T22·25-0400 |
commit | a7a43adb79393084a27589bc929e5a22877ba944 (patch) | |
tree | 327345a13a0f03ed21a54311fa518470f33c05a8 | |
parent | eae802459d7639a69baec555264f394adad043c0 (diff) |
builtins.storePath: resolve symlinks
Needed for Charon/Hydra interaction.
-rw-r--r-- | src/libexpr/primops.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 7587dccea4aa..5d5f0bfb3b5b 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -502,7 +502,11 @@ static void prim_toPath(EvalState & state, Value * * args, Value & v) static void prim_storePath(EvalState & state, Value * * args, Value & v) { PathSet context; - Path path = canonPath(state.coerceToPath(*args[0], context)); + Path path = state.coerceToPath(*args[0], context); + /* Resolve symlinks in ‘path’, unless ‘path’ itself is a symlink + directly in the store. The latter condition is necessary so + e.g. nix-push does the right thing. */ + if (!isStorePath(path)) path = canonPath(path, true); if (!isInStore(path)) throw EvalError(format("path `%1%' is not in the Nix store") % path); Path path2 = toStorePath(path); |