Add 'nix store' NAR-related manpages

This commit is contained in:
Eelco Dolstra 2020-12-09 20:06:19 +01:00
parent 2cc02bbe76
commit c14ed3f8b2
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 87 additions and 17 deletions

View file

@ -37,6 +37,13 @@ struct CmdCatStore : StoreCommand, MixCat
return "print the contents of a file in the Nix store on stdout";
}
std::string doc() override
{
return
#include "store-cat.md"
;
}
void run(ref<Store> store) override
{
cat(store->getFSAccessor());

View file

@ -11,14 +11,11 @@ struct CmdDumpPath : StorePathCommand
return "serialise a store path to stdout in NAR format";
}
Examples examples() override
std::string doc() override
{
return {
Example{
"To get a NAR from the binary cache https://cache.nixos.org/:",
"nix store dump-path --store https://cache.nixos.org/ /nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25"
},
};
return
#include "store-dump-path.md"
;
}
void run(ref<Store> store, const StorePath & storePath) override

View file

@ -94,21 +94,18 @@ struct CmdLsStore : StoreCommand, MixLs
});
}
Examples examples() override
{
return {
Example{
"To list the contents of a store path in a binary cache:",
"nix store ls --store https://cache.nixos.org/ -lR /nix/store/0i2jd68mp5g6h2sa5k9c85rb80sn8hi9-hello-2.10"
},
};
}
std::string description() override
{
return "show information about a path in the Nix store";
}
std::string doc() override
{
return
#include "store-ls.md"
;
}
void run(ref<Store> store) override
{
list(store->getFSAccessor());

19
src/nix/store-cat.md Normal file
View file

@ -0,0 +1,19 @@
R""(
# Examples
* Show the contents of a file in a binary cache:
```console
# nix store cat --store https://cache.nixos.org/ \
/nix/store/0i2jd68mp5g6h2sa5k9c85rb80sn8hi9-hello-2.10/bin/hello | hexdump -C | head -n1
00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............|
```
# Description
This command prints on standard output the contents of the regular
file *path* in a Nix store. *path* can be a top-level store path or
any file inside a store path.
)""

View file

@ -0,0 +1,23 @@
R""(
# Examples
* To get a NAR containing the GNU Hello package:
```console
# nix store dump-path nixpkgs#hello > hello.nar
```
* To get a NAR from the binary cache https://cache.nixos.org/:
```console
# nix store dump-path --store https://cache.nixos.org/ \
/nix/store/7crrmih8c52r8fbnqb933dxrsp44md93-glibc-2.25 > glibc.nar
```
# Description
This command generates a NAR file containing the serialisation of the
store path *installable*. The NAR is written to standard output.
)""

27
src/nix/store-ls.md Normal file
View file

@ -0,0 +1,27 @@
R""(
# Examples
* To list the contents of a store path in a binary cache:
```console
# nix store ls --store https://cache.nixos.org/ -lR /nix/store/0i2jd68mp5g6h2sa5k9c85rb80sn8hi9-hello-2.10
dr-xr-xr-x 0 ./bin
-r-xr-xr-x 38184 ./bin/hello
dr-xr-xr-x 0 ./share
```
* To show information about a specific file in a binary cache:
```console
# nix store ls --store https://cache.nixos.org/ -l /nix/store/0i2jd68mp5g6h2sa5k9c85rb80sn8hi9-hello-2.10/bin/hello
-r-xr-xr-x 38184 hello
```
# Description
This command shows information about *path* in a Nix store. *path* can
be a top-level store path or any file inside a store path.
)""