mirror of
https://github.com/ryan4yin/nixos-and-flakes-book
synced 2024-11-23 12:43:08 +00:00
fix: remove misleading note
This commit is contained in:
parent
915fc47eef
commit
e486604ab3
2 changed files with 2 additions and 6 deletions
|
@ -4,9 +4,7 @@
|
|||
|
||||
NixOS configuration, being a set of text files, is well-suited for version control with Git. This allows easy rollback to a previous version in case of issues.
|
||||
|
||||
One thing to note: **Any changes that are not committed and added to the Git staging area will be ignored by Nix after the configuration is managed using Git! So make sure your changes have been added to the staging area or committed before deploying.**
|
||||
|
||||
However, by default, NixOS places the configuration in `/etc/nixos`, which requires root permissions for modification, making it inconvenient for daily use. Thankfully, Flakes can help solve this problem by allowing you to place your flake anywhere you prefer.
|
||||
By default, NixOS places the configuration in `/etc/nixos`, which requires root permissions for modification, making it inconvenient for daily use. Thankfully, Flakes can help solve this problem by allowing you to place your flake anywhere you prefer.
|
||||
|
||||
For example, you can place your flake in `~/nixos-config` and create a symbolic link in `/etc/nixos` as follows:
|
||||
|
||||
|
|
|
@ -6,9 +6,7 @@
|
|||
|
||||
NixOS 的配置文件是纯文本,因此跟普通的 dotfiles 一样可以使用 Git 管理,这样可以方便的回滚到历史版本,或者在多台机器上同步配置。
|
||||
|
||||
需要注意的一点是:**在使用 Git 管理配置后,任何未被提交且未添加到 Git 暂存区的修改都会被 Nix 忽略!因此在部署前请一定确认,你的修改已添加到了暂存区或者已经提交**。
|
||||
|
||||
此外 Nix Flakes 配置也不一定需要放在 `/etc/nixos` 目录下,可以放在任意目录下,只要在部署时指定正确的路径即可。
|
||||
另外一点是,Nix Flakes 配置也不一定需要放在 `/etc/nixos` 目录下,可以放在任意目录下,只要在部署时指定正确的路径即可。
|
||||
|
||||
> 我们在前面第 3 小节的代码注释中有说明过,可以通过 `sudo nixos-rebuild switch --flake .#xxx` 的 `--flake` 参数指定 Flakes 配置的文件夹路径,并通过 `#` 后面的值来指定使用的 outputs 名称。
|
||||
|
||||
|
|
Loading…
Reference in a new issue