forked from lix-project/lix
Merge pull request #5008 from NixOS/flake-devShells-attribute
Add a `devShells` attribute to the flake schema
This commit is contained in:
commit
bee71d692a
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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>`
|
||||||
|
|
||||||
)""
|
)""
|
||||||
|
|
|
@ -33,6 +33,7 @@ The following flake output attributes must be derivations:
|
||||||
* `checks.`*system*`.`*name*
|
* `checks.`*system*`.`*name*
|
||||||
* `defaultPackage.`*system*`
|
* `defaultPackage.`*system*`
|
||||||
* `devShell.`*system*`
|
* `devShell.`*system*`
|
||||||
|
* `devShells.`*system*`.`*name*`
|
||||||
* `nixosConfigurations.`*name*`.config.system.build.toplevel
|
* `nixosConfigurations.`*name*`.config.system.build.toplevel
|
||||||
* `packages.`*system*`.`*name*
|
* `packages.`*system*`.`*name*
|
||||||
|
|
||||||
|
|
|
@ -486,7 +486,7 @@ struct CmdFlakeCheck : FlakeCommand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (name == "packages") {
|
else if (name == "packages" || name == "devShells") {
|
||||||
state->forceAttrs(vOutput, pos);
|
state->forceAttrs(vOutput, pos);
|
||||||
for (auto & attr : *vOutput.attrs) {
|
for (auto & attr : *vOutput.attrs) {
|
||||||
checkSystemName(attr.name, *attr.pos);
|
checkSystemName(attr.name, *attr.pos);
|
||||||
|
@ -914,6 +914,7 @@ struct CmdFlakeShow : FlakeCommand
|
||||||
logger->cout("%s: %s '%s'",
|
logger->cout("%s: %s '%s'",
|
||||||
headerPrefix,
|
headerPrefix,
|
||||||
attrPath.size() == 2 && attrPath[0] == "devShell" ? "development environment" :
|
attrPath.size() == 2 && attrPath[0] == "devShell" ? "development environment" :
|
||||||
|
attrPath.size() >= 2 && attrPath[0] == "devShells" ? "development environment" :
|
||||||
attrPath.size() == 3 && attrPath[0] == "checks" ? "derivation" :
|
attrPath.size() == 3 && attrPath[0] == "checks" ? "derivation" :
|
||||||
attrPath.size() >= 1 && attrPath[0] == "hydraJobs" ? "derivation" :
|
attrPath.size() >= 1 && attrPath[0] == "hydraJobs" ? "derivation" :
|
||||||
"package",
|
"package",
|
||||||
|
@ -932,6 +933,7 @@ struct CmdFlakeShow : FlakeCommand
|
||||||
|| ((attrPath.size() == 1 || attrPath.size() == 2)
|
|| ((attrPath.size() == 1 || attrPath.size() == 2)
|
||||||
&& (attrPath[0] == "checks"
|
&& (attrPath[0] == "checks"
|
||||||
|| attrPath[0] == "packages"
|
|| attrPath[0] == "packages"
|
||||||
|
|| attrPath[0] == "devShells"
|
||||||
|| attrPath[0] == "apps"))
|
|| attrPath[0] == "apps"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
@ -940,7 +942,7 @@ struct CmdFlakeShow : FlakeCommand
|
||||||
|
|
||||||
else if (
|
else if (
|
||||||
(attrPath.size() == 2 && (attrPath[0] == "defaultPackage" || attrPath[0] == "devShell"))
|
(attrPath.size() == 2 && (attrPath[0] == "defaultPackage" || attrPath[0] == "devShell"))
|
||||||
|| (attrPath.size() == 3 && (attrPath[0] == "checks" || attrPath[0] == "packages"))
|
|| (attrPath.size() == 3 && (attrPath[0] == "checks" || attrPath[0] == "packages" || attrPath[0] == "devShells"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (visitor.isDerivation())
|
if (visitor.isDerivation())
|
||||||
|
|
Loading…
Reference in a new issue