Skip to content

Improved documentation#88

Merged
danielfullmer merged 27 commits intomasterfrom
docs
Apr 16, 2021
Merged

Improved documentation#88
danielfullmer merged 27 commits intomasterfrom
docs

Conversation

@danielfullmer
Copy link
Collaborator

@danielfullmer danielfullmer commented Feb 10, 2021

Includes various improvements to robotnix documentation. Robotnix documentation is now built and deployed to docs.robotnix.org

This also now generates reference documentation for each of the robotnix module options. All non-internal options should now be properly documented.

Much thanks to @hmenke for his helpful work on this!

TODO:

  • Reorganize content from README.md into new documentation structure.
  • Developer-focused documentation. (How to add a flavor/device, using debugEnterEnv, etc.)

@danielfullmer danielfullmer added the documentation Improvements or additions to documentation label Feb 10, 2021
docs/default.nix Outdated
Comment on lines +23 to +26
Default: `${builtins.toJSON option.default}`

'' + optionalString (option ? example) ''
Example: `${builtins.toJSON option.example}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one gotcha here, namely that builtins.toJSON will not generate valid Nix code for non-empty lists and non-empty attrsets. The situation is probably also problematic for strings with embedded control characters. However, nixosOptionsDoc.optionsJSON has the same problem. Does nixpkgs contain a function for serializing data as valid Nix? At the same time, as long as none of the corner cases named above apply, using builtins.toJSON should be just fine.

Copy link
Contributor

@hmenke hmenke Feb 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found lib.generator.toPretty which comes very close:

nix-repl> v = { a = [ 1 2 3.14159265 { b = ''x\ny''; } ]; c = "z"; d = x: x + 1; }

nix-repl> lib.generators.toPretty {} v                                             
"{ \"a\" = [ 1 2 ~3.141593 { \"b\" = \"x\\ny\"; } ]; \"c\" = \"z\"; \"d\" = <λ>; }"

It's not so nice that keys in the attrset are always quoted, but at least it's valid Nix. Functions of course cannot be reasonably serialized so representing them by <λ> is quite okay. The only real problem here is the serialization of floating point numbers. I don't see why it wouldn't just print the internal representation.


on:
push:
branches: [ docs ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to change this back to master? Or do you plan to keep documentation on the docs branch from now on? Or maybe just use both master and docs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I plan to switch it back to master after merging.

@hmenke
Copy link
Contributor

hmenke commented Feb 10, 2021

Adding a new device to robotnix is actually pretty straight-forward. I've added support for Google Nexus 4 (mako) to the LineageOS flavor with just a few lines: https://git.henrimenke.de/henri/android/src/branch/master/mako.nix
It builds but I haven't flashed it yet, as on mako you have to repartition the phone because the system partition is too small to fit newer Android installations.

In the context of headings or titles we can still use capital R. Part of
my motivation for not titling the project "RobotNix" was to retain the
fun comparison with the word "robotnik", and I feel like using the
lowercased "robotnix" instead of "Robotnix" also helps a little to not
overly emphasize the "robot" part of the name.
Tested on a fresh Pixel 4a from the factory.
@danielfullmer
Copy link
Collaborator Author

Made some bigger changes to the documentation that I intend to merge soon. Should be readable at https://docs.robotnix.org/ if you want to see it now. I'll take another look tomorrow to see if I missed any typos or major sections.

@danielfullmer danielfullmer merged commit 8047eaf into master Apr 16, 2021
@danielfullmer danielfullmer deleted the docs branch May 11, 2021 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants