diff options
Diffstat (limited to 'src/nix-env/nix-env.cc')
-rw-r--r-- | src/nix-env/nix-env.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index 5dab2e60b2d0..77b7881711e4 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -831,6 +831,7 @@ static void opQuery(Globals & globals, bool printDrvPath = false; bool printOutPath = false; bool printDescription = false; + bool prebuiltOnly = false; bool compareVersions = false; bool xmlOutput = false; @@ -849,6 +850,7 @@ static void opQuery(Globals & globals, else if (*i == "--out-path") printOutPath = true; else if (*i == "--installed") source = sInstalled; else if (*i == "--available" || *i == "-a") source = sAvailable; + else if (*i == "--prebuilt-only" || *i == "-b") prebuiltOnly = true; else if (*i == "--xml") xmlOutput = true; else throw UsageError(format("unknown flag `%1%'") % *i); @@ -914,6 +916,12 @@ static void opQuery(Globals & globals, /* For XML output. */ XMLAttrs attrs; + + if (prebuiltOnly) { + if (!store->isValidPath(i->queryOutPath(globals.state)) && + !store->hasSubstitutes(i->queryOutPath(globals.state))) + continue; + } if (printStatus) { bool hasSubs = store->hasSubstitutes(i->queryOutPath(globals.state)); |