1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-06-08 09:46:01 +02:00

nix*: make filenames reflect the commands and create disambiguation pages (#16343)

This commit is contained in:
Managor 2025-05-06 11:40:10 +03:00 committed by GitHub
parent 0faf88f3ca
commit 03d6647632
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 93 additions and 60 deletions

View file

@ -0,0 +1,13 @@
# nix-build
> Build a Nix expression.
> See also: `nix build.3`.
> More information: <https://nixos.org/manual/nix/stable/command-ref/nix-build.html>.
- Build a Nix expression:
`nix-build '<nixpkgs>' {{[-A|--attr]}} {{firefox}}`
- Build a sandboxed Nix expression (on non-NixOS):
`nix-build '<nixpkgs>' {{[-A|--attr]}} {{firefox}} --option sandbox true`

View file

@ -1,7 +1,7 @@
# nix build # nix build
> Build a Nix expression (downloading from the cache when possible). > Build a Nix expression (downloading from the cache when possible).
> See also: `nix-build` for information about traditional Nix builds from expressions, `nix3 flake` for information about flakes. > See also: `nix-build` for information about traditional Nix builds from expressions, `nix flake` for information about flakes.
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-build.html>. > More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-build.html>.
- Build a package from nixpkgs, symlinking the result to `./result`: - Build a package from nixpkgs, symlinking the result to `./result`:

View file

@ -1,13 +1,11 @@
# nix-build # nix-build
> Build a Nix expression. > `nix-build` can refer to multiple commands with the same name.
> See also: `nix3 build`.
> More information: <https://nixos.org/manual/nix/stable/command-ref/nix-build.html>.
- Build a Nix expression: - View documentation for the traditional builder:
`nix-build '<nixpkgs>' {{[-A|--attr]}} {{firefox}}` `tldr nix-build.2`
- Build a sandboxed Nix expression (on non-NixOS): - View documentation for nix3 builder:
`nix-build '<nixpkgs>' {{[-A|--attr]}} {{firefox}} --option sandbox true` `tldr nix build.3`

View file

@ -1,7 +1,7 @@
# nix registry # nix registry
> Manage a Nix flake registry. > Manage a Nix flake registry.
> See also: `nix3 flake` for information about flakes. > See also: `nix flake` for information about flakes.
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-registry.html>. > More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-registry.html>.
- Pin the `nixpkgs` revision to the current version of the upstream repository: - Pin the `nixpkgs` revision to the current version of the upstream repository:

View file

@ -1,14 +1,14 @@
# nix run # nix run
> Run an application from a Nix flake. > Run an application from a Nix flake.
> See also: `nix3 flake` for information about flakes. > See also: `nix flake` for information about flakes.
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run.html>. > More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-run.html>.
- Run the default application in the flake in the current directory: - Run the default application in the flake in the current directory:
`nix run` `nix run`
- Run a command whose name matches the package name from nixpkgs (if you want a different command from that package, see `tldr nix3 shell`): - Run a command whose name matches the package name from nixpkgs (if you want a different command from that package, see `tldr nix shell`):
`nix run nixpkgs#{{pkg}}` `nix run nixpkgs#{{pkg}}`

View file

@ -1,7 +1,7 @@
# nix search # nix search
> Search for packages in a Nix flake. > Search for packages in a Nix flake.
> See also: `nix3 flake` for information about flakes. > See also: `nix flake` for information about flakes.
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-search.html>. > More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-search.html>.
- Search `nixpkgs` for a package based on its name or description: - Search `nixpkgs` for a package based on its name or description:

View file

@ -0,0 +1,29 @@
# nix-shell
> Start an interactive shell based on a Nix expression.
> See also: `nix shell.3`.
> More information: <https://nixos.org/manual/nix/stable/command-ref/nix-shell.html>.
- Start with nix expression in `shell.nix` or `default.nix` in the current directory:
`nix-shell`
- Run shell command in non-interactive shell and exit:
`nix-shell --run "{{command}} {{argument1 argument2 ...}}"`
- Start with expression in `default.nix` in the current directory:
`nix-shell {{default.nix}}`
- Start with packages loaded from nixpkgs:
`nix-shell {{[-p|--packages]}} {{package1 package2 ...}}`
- Start with packages loaded from specific nixpkgs revision:
`nix-shell {{[-p|--packages]}} {{package1 package2 ...}} {{[-I|--include]}} nixpkgs={{https://github.com/NixOS/nixpkgs/archive/nixpkgs_revision.tar.gz}}`
- Evaluate rest of file in specific interpreter, for use in `#!-scripts` (see <https://nixos.org/manual/nix/stable/#use-as-a-interpreter>):
`nix-shell -i {{interpreter}} {{[-p|--packages]}} {{package1 package2 ...}}`

View file

@ -1,7 +1,7 @@
# nix shell # nix shell
> Start a shell in which the specified packages are available. > Start a shell in which the specified packages are available.
> See also: `nix-shell` for setting up development environments, `nix3 flake` for information about flakes. > See also: `nix-shell` for setting up development environments, `nix flake` for information about flakes.
> More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-shell.html>. > More information: <https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-shell.html>.
- Start an interactive shell with some packages from `nixpkgs`: - Start an interactive shell with some packages from `nixpkgs`:

View file

@ -1,29 +1,11 @@
# nix-shell # nix-shell
> Start an interactive shell based on a Nix expression. > `nix-shell` can refer to multiple commands with the same name.
> See also: `nix3 shell`.
> More information: <https://nixos.org/manual/nix/stable/command-ref/nix-shell.html>.
- Start with nix expression in `shell.nix` or `default.nix` in the current directory: - View documentation for the traditional shell:
`nix-shell` `tldr nix-shell.2`
- Run shell command in non-interactive shell and exit: - View documentation for nix3 shell:
`nix-shell --run "{{command}} {{argument1 argument2 ...}}"` `tldr nix shell.3`
- Start with expression in `default.nix` in the current directory:
`nix-shell {{default.nix}}`
- Start with packages loaded from nixpkgs:
`nix-shell {{[-p|--packages]}} {{package1 package2 ...}}`
- Start with packages loaded from specific nixpkgs revision:
`nix-shell {{[-p|--packages]}} {{package1 package2 ...}} {{[-I|--include]}} nixpkgs={{https://github.com/NixOS/nixpkgs/archive/nixpkgs_revision.tar.gz}}`
- Evaluate rest of file in specific interpreter, for use in `#!-scripts` (see <https://nixos.org/manual/nix/stable/#use-as-a-interpreter>):
`nix-shell -i {{interpreter}} {{[-p|--packages]}} {{package1 package2 ...}}`

View file

@ -0,0 +1,29 @@
# nix-store
> Manipulate or query the Nix store.
> See also: `nix store.3`.
> More information: <https://nixos.org/manual/nix/stable/command-ref/nix-store.html>.
- Collect garbage, such as removing unused paths:
`nix-store --gc`
- Hard-link identical files together to reduce space usage:
`nix-store --optimise`
- Delete a specific store path (must be unused):
`nix-store --delete {{/nix/store/...}}`
- Show all dependencies of a store path (package), in a tree format:
`nix-store {{[-q|--query]}} --tree {{/nix/store/...}}`
- Calculate the total size of a certain store path with all the dependencies:
`du {{[-cLsh|--total --dereference --summarize --human-readable]}} $(nix-store {{[-q|--query]}} --references {{/nix/store/...}})`
- Show all dependents of a particular store path:
`nix-store {{[-q|--query]}} --referrers {{/nix/store/...}}`

View file

@ -1,29 +1,11 @@
# nix-store # nix-store
> Manipulate or query the Nix store. > `nix-store` can refer to multiple commands with the same name.
> See also: `nix3 store`.
> More information: <https://nixos.org/manual/nix/stable/command-ref/nix-store.html>.
- Collect garbage, such as removing unused paths: - View documentation for the traditional store:
`nix-store --gc` `tldr nix-store.2`
- Hard-link identical files together to reduce space usage: - View documentation for nix3 store:
`nix-store --optimise` `tldr nix store.3`
- Delete a specific store path (must be unused):
`nix-store --delete {{/nix/store/...}}`
- Show all dependencies of a store path (package), in a tree format:
`nix-store {{[-q|--query]}} --tree {{/nix/store/...}}`
- Calculate the total size of a certain store path with all the dependencies:
`du {{[-cLsh|--total --dereference --summarize --human-readable]}} $(nix-store {{[-q|--query]}} --references {{/nix/store/...}})`
- Show all dependents of a particular store path:
`nix-store {{[-q|--query]}} --referrers {{/nix/store/...}}`

View file

@ -17,7 +17,7 @@ set -e
# Iterate through all Markdown files in the 'pages' directories # Iterate through all Markdown files in the 'pages' directories
find pages* -name '*.md' -type f | while read -r path; do find pages* -name '*.md' -type f | while read -r path; do
# Extract the expected command name from the filename # Extract the expected command name from the filename
COMMAND_NAME_FILE=$(basename "$path" | head -c-4 | sed 's/nix3/nix/' | sed 's/\.fish//' | sed 's/\.js//' | sed 's/\.1//' | tr '-' ' ' | tr '[:upper:]' '[:lower:]') COMMAND_NAME_FILE=$(basename "$path" | head -c-4 | sed 's/\.fish//' | sed 's/\.js//' | sed 's/\.1//' | tr '-' ' ' | tr '[:upper:]' '[:lower:]')
# Extract the command name from the first line of the Markdown file # Extract the command name from the first line of the Markdown file
COMMAND_NAME_PAGE=$(head -n1 "$path" | tail -c+3 | sed 's/--//' | tr '-' ' ' | tr '[:upper:]' '[:lower:]') COMMAND_NAME_PAGE=$(head -n1 "$path" | tail -c+3 | sed 's/--//' | tr '-' ' ' | tr '[:upper:]' '[:lower:]')