From 428062e578243336abeacb664bf3dba2674a546f Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 21 Apr 2021 15:26:14 -0500 Subject: [PATCH] Get deriver when passing --derivation This makes Nix look up paths derivations when they are passed as a store paths. So: $ nix path-info --derivation /nix/store/0pisd259nldh8yfjvw663mspm60cn5v8-hello-2.10 now gives /nix/store/qp724w90516n4bk5r9gfb37vzmqdh3z7-hello-2.10.drv instead of "". If no deriver is available, Nix now errors instead of silently ignoring that argument. --- src/libcmd/installables.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index e15addfae..06ef4c669 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -754,10 +754,8 @@ std::set toRealisedPaths( if (mode == Realise::Nothing) settings.readOnlyMode = true; - for (auto & i : installables) - for (auto & b : i->toDerivedPathsWithHints()) - if (auto bfd = std::get_if(&b)) - res.insert(bfd->drvPath); + auto drvPaths = toDerivations(store, installables, true); + res.insert(drvPaths.begin(), drvPaths.end()); } return res;