Skip to content

Commit ead89be

Browse files
committed
Fix -- dashes rendered as em-dash
1 parent 61cb63a commit ead89be

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/posts/guides/nix-shells.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ To make this process even easier, `nix develop` now comes with special arguments
4949

5050
This allows to _run phases_ individually in the shell using `$ unpackPhase`, `$ configurePhase` `$ buildPhase`, etc.
5151

52-
...or directly using `nix develop --<PHASE>` or `nix develop --phase PHASE` (for non-standard phases).
52+
...or directly using `nix develop \--<PHASE>` or `nix develop \--phase PHASE` (for non-standard phases).
5353

54-
...or run an arbitrary command in the shell using `nix develop --command COMMAND [ARGS...]`
54+
...or run an arbitrary command in the shell using `nix develop \--command COMMAND [ARGS...]`
5555

5656
**Why should you use this?**
5757

5858
It is most useful for locally developed packages.
5959

6060
Use it to set up the environment using e.g. the `configurePhase` and perform the subsequent development using `build` and `check` phases.
61-
If your workflow includes things that are not part of a phase use `nix develop --command`
61+
If your workflow includes things that are not part of a phase use `nix develop \--command`
6262
:::
6363

6464
In essence, this is exactly what `nix-shell` was intended for!
@@ -70,7 +70,7 @@ As the default implementation in nix's `stdenv` is done as functions, an interna
7070

7171
**Solution**
7272

73-
Enter a shell using `nix develop` and run the overridden phases using `eval \$buildPhase` or `--command eval '\$buildPhase'`.
73+
Enter a shell using `nix develop` and run the overridden phases using `eval \$buildPhase` or `\--command eval '\$buildPhase'`.
7474

7575
:::
7676

@@ -216,7 +216,7 @@ This is useful to install temporary software
216216

217217
...from a [flake specifier](../../internals/2021-01-01-flake-ification/#flake-reference-conventions).
218218

219-
...from a `*.nix` file/arbitrary expression using `--impure --expr EXPR` flags
219+
...from a `*.nix` file/arbitrary expression using `\--impure \--expr EXPR` flags
220220

221221
**Why should you use this?**
222222

@@ -235,11 +235,11 @@ Notably, not mentioned here is the use of `nix shell` to load `FANCYLANGUAGE` wi
235235

236236
Apart from dropping into development shells, `nix-shell` can also be used to run commands and programs from derivation not currently installed to the user's profile. This is it can build a shell as before and run a command inside transparently.
237237

238-
We discussed the use of `nix-shell --command COMMAND ARGS` above, where we would run a command from within the build environment of a derivation. Similarly, we may want to just run a program provided by a derivation. For this `nix-shell` provided the `--run` argument
238+
We discussed the use of `nix-shell \--command COMMAND ARGS` above, where we would run a command from within the build environment of a derivation. Similarly, we may want to just run a program provided by a derivation. For this `nix-shell` provided the `\--run` argument
239239

240-
:::{.info header="\"`--command`\" vs \"`run`\""}
240+
:::{.info header="\"`\--command`\" vs \"`run`\""}
241241

242-
As a development aid, `--command` is interactive, meaning among other things, that *if a command fails or is interrupted by the user, the user is dropped into the shell with the build environment loaded*.
242+
As a development aid, `\--command` is interactive, meaning among other things, that *if a command fails or is interrupted by the user, the user is dropped into the shell with the build environment loaded*.
243243

244244
This behavior translates into an invocation using the `-p PROGRAM` argument as well as seen in the following box.
245245

@@ -257,7 +257,7 @@ Man page: asciidoc --help manpage
257257
Syntax: asciidoc --help syntax
258258
```
259259

260-
`--run` runs non-interactive and closes the shell after the command returns
260+
`\--run` runs non-interactive and closes the shell after the command returns
261261
```bash
262262
$ asciidoc
263263
zsh: command not found: asciidoc
@@ -277,19 +277,19 @@ zsh: command not found: asciidoc
277277

278278
As the functions of `nix-shell DERIVATION` and `nix-shell -p DERIVATION` were separated, the new tools come with new clearer semantics.
279279

280-
The generic `nix-shell --run` function is now `nix shell -c`. Given an installable, nix allows to run any command in an environment where the installable is present. Note that this command is run in a non-interactive shell. The shell is dropped as the command ends.
280+
The generic `nix-shell \--run` function is now `nix shell -c`. Given an installable, nix allows to run any command in an environment where the installable is present. Note that this command is run in a non-interactive shell. The shell is dropped as the command ends.
281281

282282
:::{.info}
283283
The above example using the new command would look like this:
284284

285285
```
286-
$ nix shell -c nixpkgs#asciidoc -c asciidoc
286+
$ nix shell nixpkgs#asciidoc -c asciidoc
287287
```
288288
:::
289289

290290
### `nix run`
291291

292-
Yet, `nix shell -c` will still require to type the name of the executed program. As for most programs this command is the same as the derivation name e.g. `nix shell -c nixpkgs#asciidoc -c asciidoc` another command was introduced named `nix run`. With `nix run` the previous command can be run as `nix run nixpkgs#asciidoc`.
292+
Yet, `nix shell -c` will still require to type the name of the executed program. As for most programs this command is the same as the derivation name e.g. `nix shell nixpkgs#asciidoc -c asciidoc` another command was introduced named `nix run`. With `nix run` the previous command can be run as `nix run nixpkgs#asciidoc`.
293293

294294
Naturally, the functionality of `nix run` goes further and as is the case for many other new commands mainly concerns flakes. Next to `packages`, `nixosModules` and others, flakes can now also define `apps`. Written as records with two fields -`type` (currently, necessarily `app`) and `program` (an executable path) - these apps can be run directly using `nix run`.
295295

@@ -371,7 +371,7 @@ As it stands this function does not [yet](https://github.com/NixOS/nix/pull/5189
371371

372372
## To flake or not to flake
373373

374-
Most of the new nix commands are designed in a flake first way. Most notably `nix {shell,develop,run}` expect [flake URLs](../internals/2021-01-01-flake-ification/#flake-reference-conventions) as argument. Traditional `*.nix` files can be used with the `--expr` argument all commands support. As flake mode imposes greater purity strictness, imports have to happen with the `--impure` flag given:
374+
Most of the new nix commands are designed in a flake first way. Most notably `nix {shell,develop,run}` expect [flake URLs](../internals/2021-01-01-flake-ification/#flake-reference-conventions) as argument. Traditional `*.nix` files can be used with the `\--expr` argument all commands support. As flake mode imposes greater purity strictness, imports have to happen with the `\--impure` flag given:
375375

376376
```sh
377377
$ nix shell --impure --expr "import my.nix {}"
@@ -431,5 +431,5 @@ Being so closely named to its _semantically different_ predecessor, it is imposs
431431
| **runs `shellHook`s** | yes | yes | no | no |
432432
| **use as interpreter** | yes | no | no | no |
433433
| **supports flakes** | no | yes | yes | only |
434-
| **evaluate nix file** | yes | with `--impure`, `-f` or `--expr` | with `--impure`, `-f` or `--expr` | with `--impure`, `-f` or `--expr` |
434+
| **evaluate nix file** | yes | with `\--impure`, `-f` or `\--expr` | with `\--impure`, `-f` or `\--expr` | with `\--impure`, `-f` or `\--expr` |
435435
| **modifies environment** | `PATH`, attributes mk`mkDerivation` and changes by `shellHooks` | `PATH`, attributes mk`mkDerivation` and changes by `shellHooks` | `PATH` | *nothing* |

src/posts/internals/2020-04-10-built-with-nix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ Snapshots like these also allow rollbacks as they define which versions of depen
315315

316316
Nix has some integration with GitHub Actions through [install-nix](https://github.com/marketplace/actions/install-nix), an action that **installs nix** •_•
317317

318-
With nix installed, I run `$(nix-build -A ci.compile --no-out-link)` to make Nix build the blog generator and rebuild the blog's content into `build/site`. This works because `nix-build --no-out-link` will just print the path of the resulting package to `stdout`, which in this case is only an executable script produced by the `script` function above. The next step is to take that content and push it to the deployment branch.
318+
With nix installed, I run `$(nix-build -A ci.compile \--no-out-link)` to make Nix build the blog generator and rebuild the blog's content into `build/site`. This works because `nix-build \--no-out-link` will just print the path of the resulting package to `stdout`, which in this case is only an executable script produced by the `script` function above. The next step is to take that content and push it to the deployment branch.
319319

320320
[See more...](https://github.com/ysndr/blog/blob/release/.github/workflows/main.yml)
321321

src/posts/internals/2021-01-01-flake-ification.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ To take this apart again, we face three different sections here.
295295
1. `flake-utils.lib.eachDefaultSystem`, like its name suggests will provide the attribute set in its scope for all default systems (basically linux and darwin on x86_64 hardware). Hence, we don't need to worry about these tags.
296296
2. The actual output still needs to conform to flakes' expected attributes. In this case we set `packages`, `defaultPackage`, `apps`, `defaultApp` and `devShell`. There are even more most importantly `overlay` which are referenced [below](#output-attributes)
297297
3. third one is the middle part and shows an important aspect of nix flakes.
298-
Because there is no access to impure variables (`--arg`, environment variables, the current system, etc.), `nixpkgs` must be imported explicitly for each system. Additionally, this gives the opportunity to apply any possible overlay.
298+
Because there is no access to impure variables (`\--arg`, environment variables, the current system, etc.), `nixpkgs` must be imported explicitly for each system. Additionally, this gives the opportunity to apply any possible overlay.
299299
In the case of this blog everything is defined in an external `blog.nix` file and imported from there.
300300

301301
### Output attributes
@@ -334,7 +334,7 @@ is possible to use.
334334
*Notice* that some inputs might need to be quoted due to substitution rules in your shell.
335335
:::
336336

337-
`apps` is used together with `nix run`, similarly to `npm run`. You can define binaries that can then be run directly without explicitly building them first. This allowed me to change the somewhat cryptic `$(nix-build -A packages.x86_64-linux.ci.compile --no-out-link)` to `nix run ./#compile` in the CI script. Actually given that `defaultApp` point to the same `compile` attribute, the argument `./#compile` could be elided paying with decreased clarity.
337+
`apps` is used together with `nix run`, similarly to `npm run`. You can define binaries that can then be run directly without explicitly building them first. This allowed me to change the somewhat cryptic `$(nix-build -A packages.x86_64-linux.ci.compile \--no-out-link)` to `nix run ./#compile` in the CI script. Actually given that `defaultApp` point to the same `compile` attribute, the argument `./#compile` could be elided paying with decreased clarity.
338338

339339
`devShell` is another special one used in combination with `nix develop` which opens a *`bash`* shell with the given derivation prepared.
340340

0 commit comments

Comments
 (0)