nix develop: Search in devShells.${system} by default

Make `nix develop .#foo` search `.#devShells.${system}.foo` first
This commit is contained in:
regnat 2021-07-13 11:44:19 +02:00
parent eb4788954d
commit 037c86ee04
2 changed files with 16 additions and 1 deletions

View file

@ -326,6 +326,12 @@ struct Common : InstallableCommand, MixProfile
{ {
return {"devShell." + settings.thisSystem.get(), "defaultPackage." + settings.thisSystem.get()}; 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> store) StorePath getShellOutPath(ref<Store> store)
{ {

View file

@ -84,11 +84,20 @@ the flake's `nixConfig` attribute.
# Flake output attributes # 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: flake output attributes:
* `devShell.<system>` * `devShell.<system>`
* `defaultPackage.<system>` * `defaultPackage.<system>`
If a flake output *name* is given, `nix develop` tries the following flake
output attributes:
* `devShells.<system>.<name>`
* `packages.<system>.<name>`
* `legacyPackages.<system>.<name>`
)"" )""