diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-04-17 01:21:24 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-04-17 01:21:24 +0200 |
commit | 9ea4f93f8833506c1ae18c65e0cd39d84b82298e (patch) | |
tree | 68a3f3c2c98b577d9c11e1969dc789344933e7c4 /src | |
parent | a6c4fd044c204cf07d1ed523fe59801d234b7f25 (diff) |
nix flake show: Support apps
Diffstat (limited to 'src')
-rw-r--r-- | src/nix/flake.cc | 16 |
1 files changed, 14 insertions, 2 deletions
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, |