-
-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review (typos & minor improvements) #111
Comments
Thank you very much for your review. I have just fixed some of the problems and updated them on this issue, and I will continue this work later in my free time. |
@ryan4yin as I wrote above, I wanted to first go through the book, to have a full overview (there are different things that you note during the first reading, or after completion - this issue is to save the first kind). However, for the remaining ones I will contribute myself :) This is a great collection, since Nix has valuable docs, but the information is scattered in infinite places, and there is so little for the entry level... The only piece I won't be able to contribute to for sure will be the Chinese translation, I'm sorry 😓 |
Got it.
Very much looking forward to your contribution! ❤️
It's not a problem. I'll take care of the Chinese part. |
That is great. For ease of writing (and referencing) I would also suggest formatting the files on 80-100 columns. |
Done, Everything seems to be fine after the change. #126 |
helix example of flake and module system chapter has a small typo in the comment, you probably meant "choose" not "chose" |
Shouldn't it say "which Flakes rely on"? Is "Flakes" used as the name of the feature in Nix or as a plural noun? |
Sorry to bother again: this time, I decided to avoid filing many more issues, and to collect feedback in a single evolving one.
Maybe it will end up being a list of one element, butI want to prevent large noise generation.Moreover, now I'd prefer reading your book cover-to-cover. When I'll approach the end, I hope I will have some time left and author a PR myself (or multiple, if needed) to fix anything that is still on this list.
Minor improvements
NixOS with flakes enabled
nixpkgs.pkgs
should be justpkgs
, isn't it?nixos-and-flakes-book/docs/nixos-with-flakes/nixos-with-flakes-enabled.md
Line 258 in 6754096
hardware-configuration.nix
innixos-and-flakes-book/docs/nixos-with-flakes/nixos-with-flakes-enabled.md
Line 261 in 6754096
but I found no authoritative examples, and most of the people end up customizing it (so it is unreliable to link personal configs)
currently, the best alternative I can propose is to link the (almost empty)
nixos-generate-config
wiki page_module.args
is actually documented in each appendix (of NixOS, nix-darwin, and home manager), cf. https://nixos.org/manual/nixos/stable/options#opt-_module.argsnixos-and-flakes-book/docs/nixos-with-flakes/nixos-with-flakes-enabled.md
Lines 278 to 279 in 6754096
this documentation is exactly the one extracted from the description, but I would say is a better reference
nixos-and-flakes-book/docs/nixos-with-flakes/nixos-with-flakes-enabled.md
Line 286 in 6754096
Custom cache servers
nixos-and-flakes-book/docs/nixos-with-flakes/add-custom-cache-servers.md
Lines 13 to 17 in 6754096
2.
, while the second as1.
-> md takes the freedom of making them sequential, and it renders the1.
as3.
🤦1.
is a list of one item - I'd suggest making it unsortedHow to Add ...
appears like a section title, but it's a plain paragraphnixos-and-flakes-book/docs/nixos-with-flakes/add-custom-cache-servers.md
Lines 23 to 24 in 6754096
(I usually go for numbering only when I want to reference it later, or when I want to stress the count)
nixos-and-flakes-book/docs/nixos-with-flakes/add-custom-cache-servers.md
Line 52 in 490be22
there is not much about trust, that is instead cited here. Maybe a better reference could be https://github.com/nix-community/trustix
nixos-and-flakes-book/docs/nixos-with-flakes/add-custom-cache-servers.md
Line 165 in 490be22
nixos-and-flakes-book/docs/nixos-with-flakes/add-custom-cache-servers.md
Lines 195 to 197 in 490be22
I woud just replace
ai
withmy-nixos
, since more explicitn (though Ai Hoshino is great :P)Modularize the configuration
nixpkgs
(as mostly the rest of NixOS), but I believe the canonical reference about modules to be in the NixOS docs (in particular the dedicated, extended, writing modules section)nixos-and-flakes-book/docs/nixos-with-flakes/modularize-the-configuration.md
Line 27 in 6754096
in particular, there is an explicit section about imports (not that contains much more information, but it is definitely more friendly)
nixos-and-flakes-book/docs/nixos-with-flakes/modularize-the-configuration.md
Line 188 in 6754096
nixos-and-flakes-book/docs/nixos-with-flakes/modularize-the-configuration.md
Line 299 in 6754096
Downgrading or Upgrading Packages
import
with flakesnixos-and-flakes-book/docs/nixos-with-flakes/downgrade-or-upgrade-packages.md
Line 39 in 4536260
it is true that is ubiquitous, especially for
nixpkgs
, but you're implicitly relying on the presence of the legacydefault.nix
(the flake way would benixpkgs.legacyPackages...
)it is a nice workaround even in other situations, but it's better that you know what you're doing
Ah, actually there was a related not here
nixos-and-flakes-book/docs/nixos-with-flakes/downgrade-or-upgrade-packages.md
Line 100 in 4536260
but I would explain that with
import
you're essentially taking the path, and relying ondefault.nix
(btw, it's legacy only top-level, and perfectly fine elsewhere)inherit
? It doesn't change anything, but it is idiomatic, and I believe could be good for a beginners' booknixos-and-flakes-book/docs/nixos-with-flakes/downgrade-or-upgrade-packages.md
Line 42 in 4536260
Module System and Custom Options
nix-darwin
at the same level of NixOS and home managernixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Line 8 in 6754096
and it also has its online docs (though not a search engine, to the best of my knowledge, but you can use "find in the page")
https://daiderd.com/nix-darwin/manual/index.html
nixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Lines 10 to 16 in 6754096
I would still refer the reader (even in this section) to the NixOS docs first, section "Writing modules", and then also the corresponding nixpkgs "Modules system" section as a further reading (and pointing to the rendered docs)
nixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Line 161 in 6754096
I would rephrase to make it clear that you're setting
config
, omitting it, since you do not need to declare anyoption
=> config
, since it never needs to evaluate the fullconfig
object, and thusconfig.foo
is already enoughnixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Line 208 in 6754096
I'd rephrase even the nested points, since the moment you arrive to
config.foo
you find out that is a leaf, and you conclude the execution, no dependency on the outerconfig
, that's just a value (ok, it is for sure an attribute set because oflib.mkOption
, but you could pretend it's the default value...)config.warnings =>
, since the starting point (CLI invocation) is always the samenixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Line 215 in 6754096
explaining it as a 0th point (i.e. point 1, and shift the others)
lib.mkMerge
,lib.mkIf
&lib.attrsets.mergeAttrsList
,lib.optionals
. #106 ) and here it could be worth to explain the difference betweenif ... then ... else
andlib.mkIf
in greater details, possibly going through the implementationnixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Line 223 in 6754096
nixos-and-flakes-book/docs/other-usage-of-flakes/module-system.md
Lines 357 to 361 in 6754096
Overriding
.override
to.overrideAttrs
, without an explicit comparison (nor any introduction)https://nixos.org/manual/nixpkgs/stable/#chap-overrides
nix repl
usage is interspersed and redundantOverlays
self: super:
andfinal: prev:
are equivalent, and that the latter is the "modern" terminology, while the first is still present in many placeshttps://nixos.wiki/wiki/Overlays
Custom NIX_PATH and Flake Registry
nixos-and-flakes-book/docs/best-practices/nix-path-and-flake-registry.md
Lines 16 to 18 in 490be22
since, if flakes are enabled, you can just do
nix repl nixpkgs
(that is a strict subset of the characters above, and makes use of flakes)but the true question is: do you really need
NIX_PATH
at all with flakes?The Ingenious Uses of Multiple nixpkgs Instances
import nixpkgs
around (in this and previous sections), and then cite the 1000 instances of nixpkgsimport nixpkgs
in inputs, possibly differently named inputs with the same URL (I have to check that this actually works, but I don't see why it should not)Packaging 101
https://serokell.io/blog/practical-nix-flakes#packaging-existing-applications
poetry2nix
, it can be really trivial)crane
, it can also be quite straightforward)cabal2nix
(an official NixOS project), buthaskell.nix
seems to have enough momentum as well, and even better docs, supporting both Cabal and Stack...Development Environments on NixOS
direnv
, since it is useful, but it could also handle automaticallynix develop
shell behavior https://discourse.nixos.org/t/using-nix-develop-opens-bash-instead-of-zsh/25075/6Dev Environments
The text was updated successfully, but these errors were encountered: