aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-06-29 19:08:50 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-06-29 19:08:50 +0200
commit26cf0c674f543ec86a5ccb7e05a4773559bb8f8a (patch)
tree9544ce8a48f6b7fc72fa8bbf86879a7e7887a864 /src/nix/flake.cc
parent50f13b06fb1b2f50a97323c000d1094d090f08ea (diff)
nix run: Use packages/legacyPackages as fallback if there is no app definition
'nix run' will try to run $out/bin/<name>, where <name> is the derivation name (excluding the version). This often works well: $ nix run nixpkgs#hello Hello, world! $ nix run nix -- --version nix (Nix) 2.4pre20200626_adf2fbb $ nix run patchelf -- --version patchelf 0.11.20200623.e61654b $ nix run nixpkgs#firefox -- --version Mozilla Firefox 77.0.1 $ nix run nixpkgs#gimp -- --version GNU Image Manipulation Program version 2.10.14 though not always: $ nix run nixpkgs#git error: unable to execute '/nix/store/kp7wp760l4gryq9s36x481b2x4rfklcy-git-2.25.4/bin/git-minimal': No such file or directory
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 17df29fdb..847985ea3 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -243,11 +243,14 @@ struct CmdFlakeCheck : FlakeCommand
auto checkApp = [&](const std::string & attrPath, Value & v, const Pos & pos) {
try {
+ #if 0
+ // FIXME
auto app = App(*state, v);
for (auto & i : app.context) {
auto [drvPathS, outputName] = decodeContext(i);
store->parseStorePath(drvPathS);
}
+ #endif
} catch (Error & e) {
e.addPrefix(fmt("while checking the app definition '" ANSI_BOLD "%s" ANSI_NORMAL "' at %s:\n", attrPath, pos));
throw;
@@ -544,9 +547,9 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
Strings{templateName == "" ? "defaultTemplate" : templateName},
Strings(attrsPathPrefixes), lockFlags);
- auto cursor = installable.getCursor(*evalState, true);
+ auto [cursor, attrPath] = installable.getCursor(*evalState, true);
- auto templateDir = cursor.first->getAttr("path")->getString();
+ auto templateDir = cursor->getAttr("path")->getString();
assert(store->isInStore(templateDir));