From 9ea4f93f8833506c1ae18c65e0cd39d84b82298e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Apr 2020 01:21:24 +0200 Subject: nix flake show: Support apps --- src/nix/flake.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 3c75befb9..52c8a122b 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -1065,10 +1065,12 @@ struct CmdFlakeShow : FlakeCommand attrPath[0] == "defaultPackage" || attrPath[0] == "devShell" || attrPath[0] == "nixosConfigurations" - || attrPath[0] == "nixosModules")) + || attrPath[0] == "nixosModules" + || attrPath[0] == "defaultApp")) || ((attrPath.size() == 1 || attrPath.size() == 2) && (attrPath[0] == "checks" - || attrPath[0] == "packages")) + || attrPath[0] == "packages" + || attrPath[0] == "apps")) ) { recurse(); @@ -1106,6 +1108,16 @@ struct CmdFlakeShow : FlakeCommand } } + else if ( + (attrPath.size() == 2 && attrPath[0] == "defaultApp") || + (attrPath.size() == 3 && attrPath[0] == "apps")) + { + auto aType = visitor.maybeGetAttr("type"); + if (!aType || aType->getString() != "app") + throw EvalError("not an app definition"); + logger->stdout("%s: app", headerPrefix); + } + else { logger->stdout("%s: %s", headerPrefix, -- cgit v1.2.3