From 037c86ee04d681170cedaf71f9d75c186abe9719 Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 13 Jul 2021 11:44:19 +0200 Subject: [PATCH] nix develop: Search in `devShells.${system}` by default Make `nix develop .#foo` search `.#devShells.${system}.foo` first --- src/nix/develop.cc | 6 ++++++ src/nix/develop.md | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/nix/develop.cc b/src/nix/develop.cc index 26f53db09..9ac2791f8 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -326,6 +326,12 @@ struct Common : InstallableCommand, MixProfile { return {"devShell." + settings.thisSystem.get(), "defaultPackage." + settings.thisSystem.get()}; } + Strings getDefaultFlakeAttrPathPrefixes() override + { + auto res = SourceExprCommand::getDefaultFlakeAttrPathPrefixes(); + res.emplace_front("devShells." + settings.thisSystem.get()); + return res; + } StorePath getShellOutPath(ref store) { diff --git a/src/nix/develop.md b/src/nix/develop.md index e71d9f8aa..c86c4872b 100644 --- a/src/nix/develop.md +++ b/src/nix/develop.md @@ -84,11 +84,20 @@ the flake's `nixConfig` attribute. # Flake output attributes -If no flake output attribute is given, `nix run` tries the following +If no flake output attribute is given, `nix develop` tries the following flake output attributes: * `devShell.` * `defaultPackage.` +If a flake output *name* is given, `nix develop` tries the following flake +output attributes: + +* `devShells..` + +* `packages..` + +* `legacyPackages..` + )""