2023-07-08 07:06:31 +00:00
|
|
|
|
![](./docs/public/nixos-and-flakes-book.webp)
|
2023-07-08 07:04:49 +00:00
|
|
|
|
|
|
|
|
|
# NixOS & Flakes Book :hammer_and_wrench: :heart:
|
2023-06-23 06:33:04 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
Want to know NixOS & Flakes in detail? Looking for a beginner-friendly tutorial? Then
|
|
|
|
|
you've come to the right place!
|
2023-07-08 04:00:45 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
An unofficial and opinionated NixOS & Flakes :book: for beginners:
|
|
|
|
|
https://nixos-and-flakes.thiscute.world/
|
2023-06-23 06:33:04 +00:00
|
|
|
|
|
2023-07-28 07:55:48 +00:00
|
|
|
|
中文版: https://nixos-and-flakes.thiscute.world/zh/
|
2023-06-23 13:29:29 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
> If you're using macOS,
|
|
|
|
|
> [ryan4yin/nix-darwin-kickstarter](https://github.com/ryan4yin/nix-darwin-kickstarter)
|
|
|
|
|
> may be a good starting point for you, you can learn how to use Nix with this book and
|
|
|
|
|
> take nix-darwin-kickstarter as a start point to build your own Nix configuration.
|
2023-07-19 07:06:27 +00:00
|
|
|
|
|
2023-07-06 02:08:27 +00:00
|
|
|
|
## Feedback and Discussion
|
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
I’m not an expert on NixOS, and I’ve only been using NixOS for less than 9 months until
|
|
|
|
|
now(2024-02), so there must be some misconceptions or inappropriate examples in the book.
|
|
|
|
|
If anyone finds anything incorrect or have any questions / suggestions, just let me know
|
|
|
|
|
about it by open an issue or join the discussion on
|
|
|
|
|
[GitHub Discussions](https://github.com/ryan4yin/nixos-and-flakes-book/discussions), I'm
|
|
|
|
|
glad continue to optimize the content of this book.
|
2024-02-12 07:43:02 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
The reason why I wrote this little book was only because no one in the community did it
|
|
|
|
|
for me, who was a beginner at the time, so I chose to do it myself. Even though I knew I
|
|
|
|
|
could make mistakes, it's much better than do nothing.
|
2024-02-12 07:43:02 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
My hope is that this book can help more people, enabling them to experience the joys of
|
|
|
|
|
NixOS. Hope you like it!
|
2024-02-12 07:43:02 +00:00
|
|
|
|
|
2023-06-23 15:18:01 +00:00
|
|
|
|
## Introduction to Flakes
|
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
The flakes experimental feature is a major development for Nix, it introduces a policy for
|
|
|
|
|
managing dependencies between Nix expressions, it improves reproducibility, composability
|
|
|
|
|
and usability in the Nix ecosystem. Although it's still an experimental feature, flakes
|
|
|
|
|
have been widely used by the Nix community.[^1]
|
2023-06-23 15:18:01 +00:00
|
|
|
|
|
|
|
|
|
Flakes is one of the most significant changes the nix project has ever seen.[^2]
|
|
|
|
|
|
2023-07-04 04:18:46 +00:00
|
|
|
|
## A Word of Caution about Flakes
|
2023-06-23 15:18:01 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
The benefits of Flakes are evident, and the entire NixOS community has embraced it
|
|
|
|
|
wholeheartedly. Currently, more than half of the users utilize Flakes[^3], providing
|
|
|
|
|
assurance that Flakes will not be deprecated.
|
2023-06-23 15:18:01 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
:warning: However, it's important to note that **Flakes is still an experimental
|
|
|
|
|
feature**. Some issues persist, and there is a possibility of introducing breaking changes
|
|
|
|
|
during the stabilization process. The extent of these breaking changes remains uncertain.
|
2023-06-23 15:18:01 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
Overall, I strongly recommend everyone to use Flakes, especially since this book revolves
|
|
|
|
|
around NixOS and Flakes. However, it's crucial to be prepared for potential problems that
|
|
|
|
|
may arise due to forthcoming breaking changes.
|
2023-06-23 15:18:01 +00:00
|
|
|
|
|
2023-06-23 06:33:04 +00:00
|
|
|
|
## Contribution
|
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
> _A real community, however, exists only when its members interact in a meaningful way
|
|
|
|
|
> that deepens their understanding of each other and leads to learning._
|
2023-06-23 06:33:04 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
If you find something which doesn't make sense, or something doesn't seem right, please
|
|
|
|
|
make a pull request and please add valid and well-reasoned explanations about your changes
|
|
|
|
|
or comments.
|
2023-06-23 06:33:04 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
Before adding a pull request, please see the
|
|
|
|
|
[contributing guidelines](/.github/CONTRIBUTING.md).
|
2023-06-23 06:33:04 +00:00
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
Thank you to
|
|
|
|
|
[all the people](https://github.com/ryan4yin/nixos-and-flakes-book/graphs/contributors)
|
|
|
|
|
who already contributed to this project!
|
2023-06-23 06:33:04 +00:00
|
|
|
|
|
2023-07-17 10:24:09 +00:00
|
|
|
|
## References
|
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
- The cover is based on the image from anime
|
|
|
|
|
"[The Rolling Girls](https://en.wikipedia.org/wiki/The_Rolling_Girls)"
|
2024-03-08 03:41:41 +00:00
|
|
|
|
- The NixOS logo is from [NixOS](https://nixos.org/)
|
2023-07-17 10:24:09 +00:00
|
|
|
|
|
2023-06-23 06:33:04 +00:00
|
|
|
|
## License
|
|
|
|
|
|
2024-03-16 11:29:05 +00:00
|
|
|
|
[NixOS & Flakes Book](https://github.com/ryan4yin/nixos-and-flakes-book) © 2023 by Ryan
|
|
|
|
|
Yin is licensed under [CC BY-SA 4.0](./LICENSE.md)
|
2024-03-08 04:18:27 +00:00
|
|
|
|
|
2024-05-10 01:40:43 +00:00
|
|
|
|
[^1]: [Flakes - NixOS Wiki](https://wiki.nixos.org/wiki/Flakes)
|
2024-03-16 11:29:05 +00:00
|
|
|
|
[^2]:
|
|
|
|
|
[Flakes are such an obviously good thing](https://grahamc.com/blog/flakes-are-an-obviously-good-thing/)
|
|
|
|
|
|
|
|
|
|
[^3]:
|
|
|
|
|
[Draft: 1 year roadmap - NixOS Foundation](https://nixos-foundation.notion.site/1-year-roadmap-0dc5c2ec265a477ea65c549cd5e568a9)
|