aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-12-09 20:06:19 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-12-21 13:32:28 +0100
commitc14ed3f8b2cbddb335227d2ff5188896e76b713f (patch)
treeb4f737b93faf65477932c81242762f4f5a04bb0d
parent2cc02bbe7675acb4754b928b5c57fa316600e877 (diff)
Add 'nix store' NAR-related manpages
-rw-r--r--src/nix/cat.cc7
-rw-r--r--src/nix/dump-path.cc11
-rw-r--r--src/nix/ls.cc15
-rw-r--r--src/nix/store-cat.md19
-rw-r--r--src/nix/store-dump-path.md23
-rw-r--r--src/nix/store-ls.md27
6 files changed, 86 insertions, 16 deletions
diff --git a/src/nix/cat.cc b/src/nix/cat.cc
index fe2f0a241..e28ee3c50 100644
--- a/src/nix/cat.cc
+++ b/src/nix/cat.cc
@@ -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());
diff --git a/src/nix/dump-path.cc b/src/nix/dump-path.cc
index 63393ef9c..c4edc894b 100644
--- a/src/nix/dump-path.cc
+++ b/src/nix/dump-path.cc
@@ -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
diff --git a/src/nix/ls.cc b/src/nix/ls.cc
index df67240f9..d48287f27 100644
--- a/src/nix/ls.cc
+++ b/src/nix/ls.cc
@@ -94,19 +94,16 @@ struct CmdLsStore : StoreCommand, MixLs
});
}
- Examples examples() override
+ std::string description() 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"
- },
- };
+ return "show information about a path in the Nix store";
}
- std::string description() override
+ std::string doc() override
{
- return "show information about a path in the Nix store";
+ return
+ #include "store-ls.md"
+ ;
}
void run(ref<Store> store) override
diff --git a/src/nix/store-cat.md b/src/nix/store-cat.md
new file mode 100644
index 000000000..da2073473
--- /dev/null
+++ b/src/nix/store-cat.md
@@ -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.
+
+)""
diff --git a/src/nix/store-dump-path.md b/src/nix/store-dump-path.md
new file mode 100644
index 000000000..4ef563526
--- /dev/null
+++ b/src/nix/store-dump-path.md
@@ -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.
+
+)""
diff --git a/src/nix/store-ls.md b/src/nix/store-ls.md
new file mode 100644
index 000000000..836efce42
--- /dev/null
+++ b/src/nix/store-ls.md
@@ -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.
+
+)""