1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 06:01:48 +02:00

nix show-derivation -> nix derivation show

This commit is contained in:
John Ericson 2023-04-02 13:59:19 -04:00
parent 4e9f32f993
commit 2b98af2e62
7 changed files with 35 additions and 9 deletions

25
src/nix/derivation.cc Normal file
View file

@ -0,0 +1,25 @@
#include "command.hh"
using namespace nix;
struct CmdDerivation : virtual NixMultiCommand
{
CmdDerivation() : MultiCommand(RegisterCommand::getCommandsFor({"derivation"}))
{ }
std::string description() override
{
return "Work with derivations, Nix's notion of a build plan.";
}
Category category() override { return catUtility; }
void run() override
{
if (!command)
throw UsageError("'nix derivation' requires a sub-command.");
command->second->run();
}
};
static auto rCmdDerivation = registerCommand<CmdDerivation>("derivation");

View file

@ -127,6 +127,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
{"optimise-store", {"store", "optimise"}},
{"ping-store", {"store", "ping"}},
{"sign-paths", {"store", "sign"}},
{"show-derivation", {"derivation", "show"}},
{"to-base16", {"hash", "to-base16"}},
{"to-base32", {"hash", "to-base32"}},
{"to-base64", {"hash", "to-base64"}},

View file

@ -1,5 +1,5 @@
// FIXME: integrate this with nix path-info?
// FIXME: rename to 'nix store show-derivation' or 'nix debug show-derivation'?
// FIXME: rename to 'nix store derivation show' or 'nix debug derivation show'?
#include "command.hh"
#include "common-args.hh"
@ -61,4 +61,4 @@ struct CmdShowDerivation : InstallablesCommand
}
};
static auto rCmdShowDerivation = registerCommand<CmdShowDerivation>("show-derivation");
static auto rCmdShowDerivation = registerCommand2<CmdShowDerivation>({"derivation", "show"});

View file

@ -8,7 +8,7 @@ R""(
[store derivation]: ../../glossary.md#gloss-store-derivation
```console
# nix show-derivation nixpkgs#hello
# nix derivation show nixpkgs#hello
{
"/nix/store/s6rn4jz1sin56rf4qj5b5v8jxjm32hlk-hello-2.10.drv": {
@ -20,14 +20,14 @@ R""(
NixOS system:
```console
# nix show-derivation -r /run/current-system
# nix derivation show -r /run/current-system
```
* Print all files fetched using `fetchurl` by Firefox's dependency
graph:
```console
# nix show-derivation -r nixpkgs#firefox \
# nix derivation show -r nixpkgs#firefox \
| jq -r '.[] | select(.outputs.out.hash and .env.urls) | .env.urls' \
| uniq | sort
```