diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2022-02-11 18:11:08 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2022-02-22 11:47:41 +0100 |
commit | 162fbe31ffe4c2b2d7648e5df2d5a0c9b4a44996 (patch) | |
tree | 583872a69ddbd873b4c08dcd61ab68f9e2a0443c /src | |
parent | caf51729450d4c57d48ddbef8e855e9bf65f8792 (diff) |
Replace defaultBla.$system with bla.$system.default
This also simplifies some InstallableFlake logic and fixes 'nix
bundle' parsing its installable twice.
Fixes #5532.
Diffstat (limited to 'src')
-rw-r--r-- | src/libcmd/installables.cc | 5 | ||||
-rw-r--r-- | src/nix/bundle.cc | 11 | ||||
-rw-r--r-- | src/nix/develop.cc | 9 | ||||
-rw-r--r-- | src/nix/flake.cc | 2 | ||||
-rw-r--r-- | src/nix/run.cc | 5 |
5 files changed, 23 insertions, 9 deletions
diff --git a/src/libcmd/installables.cc b/src/libcmd/installables.cc index 644954977..c07e39628 100644 --- a/src/libcmd/installables.cc +++ b/src/libcmd/installables.cc @@ -158,7 +158,10 @@ SourceExprCommand::SourceExprCommand() Strings SourceExprCommand::getDefaultFlakeAttrPaths() { - return {"defaultPackage." + settings.thisSystem.get()}; + return { + "packages." + settings.thisSystem.get() + ".default", + "defaultPackage." + settings.thisSystem.get() + }; } Strings SourceExprCommand::getDefaultFlakeAttrPathPrefixes() diff --git a/src/nix/bundle.cc b/src/nix/bundle.cc index c13018328..6b891a6ee 100644 --- a/src/nix/bundle.cc +++ b/src/nix/bundle.cc @@ -49,9 +49,11 @@ struct CmdBundle : InstallableCommand Category category() override { return catSecondary; } + // FIXME: cut&paste from CmdRun. Strings getDefaultFlakeAttrPaths() override { Strings res{ + "apps." + settings.thisSystem.get() + ".default", "defaultApp." + settings.thisSystem.get() }; for (auto & s : SourceExprCommand::getDefaultFlakeAttrPaths()) @@ -61,10 +63,7 @@ struct CmdBundle : InstallableCommand Strings getDefaultFlakeAttrPathPrefixes() override { - Strings res{ - "apps." + settings.thisSystem.get() + "." - - }; + Strings res{"apps." + settings.thisSystem.get() + "."}; for (auto & s : SourceExprCommand::getDefaultFlakeAttrPathPrefixes()) res.push_back(s); return res; @@ -80,7 +79,9 @@ struct CmdBundle : InstallableCommand const flake::LockFlags lockFlags{ .writeLockFile = false }; InstallableFlake bundler{this, evalState, std::move(bundlerFlakeRef), bundlerName, - {"defaultBundler." + settings.thisSystem.get()}, + {"bundlers." + settings.thisSystem.get() + ".default", + "defaultBundler." + settings.thisSystem.get() + }, {"bundlers." + settings.thisSystem.get() + "."}, lockFlags }; diff --git a/src/nix/develop.cc b/src/nix/develop.cc index f88f5909c..92e31599a 100644 --- a/src/nix/develop.cc +++ b/src/nix/develop.cc @@ -325,8 +325,15 @@ struct Common : InstallableCommand, MixProfile Strings getDefaultFlakeAttrPaths() override { - return {"devShell." + settings.thisSystem.get(), "defaultPackage." + settings.thisSystem.get()}; + Strings paths{ + "devShells." + settings.thisSystem.get() + ".default", + "devShell." + settings.thisSystem.get(), + }; + for (auto & p : SourceExprCommand::getDefaultFlakeAttrPaths()) + paths.push_back(p); + return paths; } + Strings getDefaultFlakeAttrPathPrefixes() override { auto res = SourceExprCommand::getDefaultFlakeAttrPathPrefixes(); diff --git a/src/nix/flake.cc b/src/nix/flake.cc index cd85bcea6..303edb9fe 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -651,7 +651,7 @@ struct CmdFlakeCheck : FlakeCommand }; static Strings defaultTemplateAttrPathsPrefixes{"templates."}; -static Strings defaultTemplateAttrPaths = {"defaultTemplate"}; +static Strings defaultTemplateAttrPaths = {"templates.default", "defaultTemplate"}; struct CmdFlakeInitCommon : virtual Args, EvalCommand { diff --git a/src/nix/run.cc b/src/nix/run.cc index bae64ed39..a67c23bcb 100644 --- a/src/nix/run.cc +++ b/src/nix/run.cc @@ -158,7 +158,10 @@ struct CmdRun : InstallableCommand Strings getDefaultFlakeAttrPaths() override { - Strings res{"defaultApp." + settings.thisSystem.get()}; + Strings res{ + "apps." + settings.thisSystem.get() + ".default", + "defaultApp." + settings.thisSystem.get(), + }; for (auto & s : SourceExprCommand::getDefaultFlakeAttrPaths()) res.push_back(s); return res; |