From 3488fa7c6cef487d3f9501e89894f9e632e678db Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <edolstra@gmail.com>
Date: Wed, 29 May 2019 21:30:22 +0200
Subject: [PATCH] Hack: Use legacyPackages from Nixpkgs

Nixpkgs doesn't provide a clean "packages" set yet, so until that's
the case, look for packages in "legacyPackages" as well.
---
 src/nix/installables.cc | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index df5214f13..ea12cd79c 100644
--- a/src/nix/installables.cc
+++ b/src/nix/installables.cc
@@ -236,9 +236,9 @@ struct InstallableFlake : InstallableValue
 
         auto emptyArgs = state.allocBindings(0);
 
-        // As a convenience, look for the attribute in
-        // 'provides.packages'.
         if (searchPackages) {
+            // As a convenience, look for the attribute in
+            // 'provides.packages'.
             if (auto aPackages = *vProvides->attrs->get(state.symbols.create("packages"))) {
                 try {
                     auto * v = findAlongAttrPath(state, *attrPaths.begin(), *emptyArgs, *aPackages->value);
@@ -247,6 +247,17 @@ struct InstallableFlake : InstallableValue
                 } catch (AttrPathNotFound & e) {
                 }
             }
+
+            // As a temporary hack until Nixpkgs is properly converted
+            // to provide a clean 'packages' set, look in 'legacyPackages'.
+            if (auto aPackages = *vProvides->attrs->get(state.symbols.create("legacyPackages"))) {
+                try {
+                    auto * v = findAlongAttrPath(state, *attrPaths.begin(), *emptyArgs, *aPackages->value);
+                    state.forceValue(*v);
+                    return v;
+                } catch (AttrPathNotFound & e) {
+                }
+            }
         }
 
         // Otherwise, look for it in 'provides'.