!avYyleMexqjFHoqrME:nixos.org

Nix Documentation

421 Members
Discussion about documentation improvements around the Nix ecosystem86 Servers

Load older messages


SenderMessageTime
17 Jan 2024
@danielsidhion:nixos.devdanielsidhion * The nix manuals are built with mdbook, which has stuff like https://github.com/FauconFan/mdbook-cmdrun which might be a possible solution for repl testing08:12:54
@danielsidhion:nixos.devdanielsidhionIdeally the manuals should be able to reuse the same solution, but I find that hard unless the manuals move to mdbook as well (something that I have in a note to maybe explore some day)08:13:44
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @fricklerhandwerk:matrix.org

My opinion on this somewhat technically unqualified because I haven’t done concrete work on it, but I see a few theoretical advantages to have pairs of code blocks for input/output:

  • No fancy parsing needed, can be hooked into markdown processors. On nix.dev we have highlighting of expression/value pairs which demonstrate this.
  • Easier to type, obvious how to copy paste
  • No implicit state possible or required. State bad.

Generally documentation (and everything, really) should be low-tech so it’s easy to contribute to and understand how it works. That is, it shouldn’t do anything clever, because it will be hard to change for most people if it does, if only because it requires time to figure out. And time is a very scarce resource.

Based on your input: https://github.com/NixOS/nix.dev/issues/864

I am not sure if this qualifies as low-tech. Maybe it does because all it uses is a CLI tool. With modern tools, it is easy to make a heavily automatically documented CLI tool (e.g. if using Rust: can use bpaf/clap both convert doc strings into CLI help strings).

However, low-tech ought to be measured against cost-of-manual-work? In this particular case: cost of copying+pasting, verifying output expression against expectation, validating that examples remain valid across Nix updates.

11:05:57
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @fricklerhandwerk:matrix.org

My opinion on this somewhat technically unqualified because I haven’t done concrete work on it, but I see a few theoretical advantages to have pairs of code blocks for input/output:

  • No fancy parsing needed, can be hooked into markdown processors. On nix.dev we have highlighting of expression/value pairs which demonstrate this.
  • Easier to type, obvious how to copy paste
  • No implicit state possible or required. State bad.

Generally documentation (and everything, really) should be low-tech so it’s easy to contribute to and understand how it works. That is, it shouldn’t do anything clever, because it will be hard to change for most people if it does, if only because it requires time to figure out. And time is a very scarce resource.

*

Based on your input: https://github.com/NixOS/nix.dev/issues/864

I am not sure if this qualifies as low-tech. Maybe it does because all it uses is a CLI tool. With modern tools, it is easy to make a heavily automatically documented CLI tool (e.g. if using Rust: can use bpaf/clap both convert doc strings into CLI help strings).

However, low-tech ought to be measured against cost-of-manual-work? In this particular case: cost of copying+pasting, verifying output expression against expectation, validating that examples remain valid across Nix updates.

(Regardless: not a "must-do". Only a "could-do". Happy to execute on a draft version, if time can be made for its review, with full understanding that it will likely not be accepted.)

11:33:17
@bzzm3r:matrix.org@bzzm3r:matrix.org *

Based on your input: https://github.com/NixOS/nix.dev/issues/864

I am not sure if this qualifies as low-tech. Maybe it does because all it uses is a CLI tool. With modern tools, it is easy to make a heavily automatically documented CLI tool (e.g. if using Rust: can use bpaf/clap both convert doc strings into CLI help strings).

However, low-tech ought to be measured against cost-of-manual-work? In this particular case: cost of copying+pasting, verifying output expression against expectation, validating that examples remain valid across Nix updates.

(Regardless: not a "must-do". Only a "could-do". Happy to execute on a draft version, if time can be made for its review, with full understanding that it will likely not be accepted. Will not create a draft version if it only adds to review burden.)

11:34:03
@bzzm3r:matrix.org@bzzm3r:matrix.orgPer your request, even simpler: https://github.com/NixOS/nix/pull/979311:35:04
@bzzm3r:matrix.org@bzzm3r:matrix.org *

Based on your input: https://github.com/NixOS/nix.dev/issues/864

I am not sure if this qualifies as low-tech. Maybe it does because all it uses is a CLI tool. With modern tools, it is easy to make a heavily automatically documented CLI tool (e.g. if using Rust: can use bpaf/clap both convert doc strings into CLI help strings). However, it is still a tool, and the use of a tool necessarily moves us farther away from low-tech.

However, low-tech ought to be measured against cost-of-manual-work? In this particular case: cost of copying+pasting, verifying output expression against expectation, validating that examples remain valid across Nix updates.

(Regardless: not a "must-do". Only a "could-do". Happy to execute on a draft version, if time can be made for its review, with full understanding that it will likely not be accepted. Will not create a draft version if it only adds to review burden.)

12:02:40
@mightyiam:matrix.org@mightyiam:matrix.org bzm3r: the doctester is coming along 12:05:26
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @mightyiam:matrix.org
bzm3r: the doctester is coming along
Is there an intro document to read which lays out the project's scope/goals? Do the simplest "parts" (as thought about in https://github.com/NixOS/nix.dev/issues/864) exist already for usage as CLI tools?
12:08:00
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @mightyiam:matrix.org
bzm3r: the doctester is coming along
* Is there an intro document to read which lays out the project's scope/goals? Do the simplest "parts" (as thought about in https://github.com/NixOS/nix.dev/issues/864) exist already for usage as "manual" CLI tools?
12:08:27
@bzzm3r:matrix.org@bzzm3r:matrix.org * Is there an intro document to read which lays out the project's scope/goals? Do the simplest "parts" (as thought about in https://github.com/NixOS/nix.dev/issues/864) exist already for usage as "manually invoked CLI tools? 12:10:15
@bzzm3r:matrix.org@bzzm3r:matrix.org * Is there an intro document to read which lays out the project's scope/goals? Do the simplest "parts" (as thought about in https://github.com/NixOS/nix.dev/issues/864) exist already for usage as manually invoked CLI tools? 12:10:20
@mightyiam:matrix.org@mightyiam:matrix.orgSorry, there's no documentation. There are tests for the repl examples and there are tests for the WIP expression examples. https://github.com/mobusoperandi/eelco/tree/0eb9042220befe188aa4399ffc6615579cebdd5f/crates/eelco/tests12:10:46
@mightyiam:matrix.org@mightyiam:matrix.org

Repl example example:

```nix-repl
nix-shnepl> nope
dope
```
12:11:57
@mightyiam:matrix.org@mightyiam:matrix.org

Expression example example:

```nix
null
```

If it evaluates into null then it's good. If it evaluates into anything else it's bad. If it fails to evaluate, it's bad. The idea is that the author will use Nix assertions to prove their points in the example.

12:13:49
@mightyiam:matrix.org@mightyiam:matrix.orgFor the expression example, we can think of a future feature where the expression is a function that will be called with a scope.12:16:05
@mightyiam:matrix.org@mightyiam:matrix.orgThe usage of assertions in examples is inspired by Rust doctests.12:18:23
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @mightyiam:matrix.org
Sorry, there's no documentation. There are tests for the repl examples and there are tests for the WIP expression examples.
https://github.com/mobusoperandi/eelco/tree/0eb9042220befe188aa4399ffc6615579cebdd5f/crates/eelco/tests
How does a user specify input? What kind of output does does a doc tester produce? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work?
12:22:53
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @mightyiam:matrix.org
Sorry, there's no documentation. There are tests for the repl examples and there are tests for the WIP expression examples.
https://github.com/mobusoperandi/eelco/tree/0eb9042220befe188aa4399ffc6615579cebdd5f/crates/eelco/tests
* How does a user specify input (is there some sort of expected syntax for that?)? What kind of output does does a doc tester produce? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work?
12:23:13
@bzzm3r:matrix.org@bzzm3r:matrix.org * How does a user specify input (is there some sort of expected syntax for that, or is it just a nix assertion expression)? What kind of output does does a doc tester produce? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work? 12:23:24
@bzzm3r:matrix.org@bzzm3r:matrix.org * How does a user specify input (e.g. is there some sort of expected syntax for that, or is it just a nix assertion expression; if the latter, can the tool take a file which is just a list of assertions to verify)? What kind of output does does a doc tester produce (is it just a pass/fail, is there a way to extract the LHS and RHS of the input assertions)? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work? 12:25:18
@bzzm3r:matrix.org@bzzm3r:matrix.org * How does a user specify input (e.g. is there some sort of expected syntax for that, or is it just a nix assertion expression; if the latter, can the tool take a file which is just a list of assertions to verify, even if the file is not itself a proper "*.nix"?)? What kind of output does does a doc tester produce (is it just a pass/fail, is there a way to extract the LHS and RHS of the input assertions)? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work? 12:26:50
@bzzm3r:matrix.org@bzzm3r:matrix.org *

How does a user specify input, precisely? If I look for example at the Rust doctests page, there's a fair bit there about syntax. There's also the additional constraint that these things exist in doc strings. We don't really/necessarily have docstrings here, so how do I present a list of assertions for a nix repl to check?

What kind of output does does a doc tester produce (is it just a pass/fail, is there a way to extract the LHS and RHS of the input assertions)? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work?

12:30:57
@mightyiam:matrix.org@mightyiam:matrix.orgI lost you at "input". What's input, please?12:31:03
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @mightyiam:matrix.org
I lost you at "input". What's input, please?
Sorry, I realized that I wasn't being too clear, so I tried to work no improving what I mean. How do I give the program something to test? Do I give it a nix expression that is an assertion? Which assertion function precisely should I be using in that case? lib.assertMessage? One of the arguments to lib.assertMessage is a predicate to test.
12:35:45
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @mightyiam:matrix.org
I lost you at "input". What's input, please?
* Sorry, I realized that I wasn't being too clear, so I tried to work on improving what I mean. How do I give the program something to test? Do I give it a nix expression that is an assertion? Which assertion function precisely should I be using in that case? lib.assertMessage? One of the arguments to lib.assertMessage is a predicate to test.
12:35:54
@bzzm3r:matrix.org@bzzm3r:matrix.org * Sorry, I realized that I wasn't being too clear, so I tried to work on improving what I mean. How do I give the program something to test? Do I give it a nix expression that is an assertion? Which assertion function precisely should I be using in that case? lib.assertMessage? 12:36:10
@bzzm3r:matrix.org@bzzm3r:matrix.org *

How does a user specify input, precisely? If I look for example at the Rust doctests page, there's a fair bit there about syntax. There's also the additional constraint that these things exist in doc strings. We don't really/necessarily have docstrings here, so how do I present to the program what is essentially a list of assertions for a nix repl to check?

What kind of output does does a doc tester produce (is it just a pass/fail, is there a way to extract the LHS and RHS of the input assertions)? Would you find it useful to co-opt the language/structure in the issue linked above, or does it pose unnecessary constraints on your work?

12:36:45
@mightyiam:matrix.org@mightyiam:matrix.org The doctester is really dumb when it comes to expressions. It just passes them to nix eval. 12:36:52
@mightyiam:matrix.org@mightyiam:matrix.orgThere are assertions built into the language.12:37:17

Show newer messages


Back to Room ListRoom Version: 6