aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-02-22 14:19:39 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-02-22 14:19:39 +0100
commitd4428d00ae05cd21c256f9490c7f089ec04fd962 (patch)
tree056cb0006f70b971fb6c07a92fc35794bfb4c54b /src/nix/flake.cc
parent162fbe31ffe4c2b2d7648e5df2d5a0c9b4a44996 (diff)
nix flake check: Warn about deprecated flake outputs
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 303edb9fe..14a235501 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -501,6 +501,17 @@ struct CmdFlakeCheck : FlakeCommand
state->forceValue(vOutput, pos);
+ std::string_view replacement =
+ name == "defaultPackage" ? "packages.<system>.default" :
+ name == "defaultApps" ? "apps.<system>.default" :
+ name == "defaultTemplate" ? "templates.default" :
+ name == "defaultBundler" ? "bundlers.<system>.default" :
+ name == "overlay" ? "overlays.default" :
+ name == "devShell" ? "devShells.<system>.default" :
+ "";
+ if (replacement != "")
+ warn("flake output attribute '%s' is deprecated; use '%s' instead", name, replacement);
+
if (name == "checks") {
state->forceAttrs(vOutput, pos);
for (auto & attr : *vOutput.attrs) {