feat: add faq

This commit is contained in:
Ryan Yin 2023-07-07 15:47:34 +08:00
parent 351b649294
commit 3a9f24ea65
3 changed files with 34 additions and 1 deletions

View file

@ -239,6 +239,10 @@ export default defineConfig({
text: "Advanced Topics",
items: [{ text: "Links", link: "/advanced-topics/index.md" }],
},
{
text: "FAQ",
items: [{ text: "FAQ", link: "/faq/index.md" }],
},
],
socialLinks: [
@ -400,7 +404,13 @@ export default defineConfig({
},
{
text: "其他进阶话题",
items: [{ text: "简介", link: "/zh/advanced-topics/index.md" }],
items: [
{ text: "其他进阶话题", link: "/zh/advanced-topics/index.md" },
],
},
{
text: "常见问题 FAQ",
items: [{ text: "常见问题 FAQ", link: "/zh/faq/index.md" }],
},
],

11
docs/faq/index.md Normal file
View file

@ -0,0 +1,11 @@
# Frequently Asked Questions
## What is the difference between NixOS rollback capability and btrfs/zfs system snapshot rollback?
The difference lies in the nature of the snapshots. System snapshots created with btrfs/zfs are non-reproducible, meaning they do not include the "knowledge" of how to build the snapshot from scratch and are therefore **unexplainable**.
On the other hand, NixOS configuration is a piece of "knowledge" that can build an identical OS from scratch. It is **explainable** and can be automatically built with just a few simple commands. The NixOS configuration serves as a documentation of all the changes made to your OS and is also used to automatically build the OS itself.
The NixOS configuration file is like the **source code** of a program. As long as the source code is intact, it is easy to modify, review, or rebuild an identical program. In contrast, system snapshots are like compiled binary programs derived from source code, making it much more difficult to modify or review them. Moreover, snapshots are large in size, making sharing or migrating them more costly compared to source code.
However, this doesn't mean that NixOS eliminates the need for system snapshots. As mentioned in Chapter 1 of this book, NixOS can only guarantee reproducibility for everything declared in the declarative configuration. Other aspects of the system that are not covered by the declarative configuration, such as dynamic data in MySQL/PostgreSQL, user-uploaded files, system logs, videos, music, and images in user home directories, still require system snapshots or other means of backup.

12
docs/zh/faq/index.md Normal file
View file

@ -0,0 +1,12 @@
# 常见问题 FAQ
## NixOS 的回滚能力与 btrfs/zfs 系统快照回滚有何不同?
区别在于,系统快照的内容是不可复现的,快照内容不包含如何从零构建这个快照的「知识」,是**不可解释的**。
而 NixOS 的配置是一份从零构建出一个一模一样的 OS 的「知识」,是**可解释的**而且可以通过简单几行命令就自动完成这个构建。NixOS 配置本身既是一份记录你的 OS 都做过哪些变更的文档,也是用于自动构建出这个 OS 的配置。
NixOS 的配置文件就像是程序的**源代码**,只要源代码没丢,修改程序、审查程序,或者重新构建出一个一模一样的程序都很简单。
而系统快照就像是源代码编译出来的二进制程序,要对它做修改、审查,都要难得多。而且这个快照很大,分享或者迁移它的成本都要比源代码高得多。
但这并不是说有了 NixOS 就不需要系统快照了,本书第一章就介绍了 NixOS 只能保证在声明式配置中声明的所有内容都是可复现的,而其他未声明式配置覆盖到的系统状态是不受它管辖的。比如 MySQL/PostgreSQL 的动态数据、用户上传的文件、系统日志等等,用户 Home 目录下的视频、音乐、图片等等,这些内容都还是需要系统快照或者其他手段来备份。