feat: add notes for nixos-rebuild

This commit is contained in:
Ryan Yin 2023-12-05 09:59:17 +08:00
parent e94bb6c9b1
commit 4f60d3ccc8
2 changed files with 4 additions and 0 deletions

View File

@ -214,6 +214,8 @@ After adjusting the parameters, the content of `/etc/nixos/flake.nix` is as foll
Then run `sudo nixos-rebuild switch` to apply the configuration, and home-manager will be installed automatically.
> If your system's hostname is not `nixos-test`, you need to modify the name of `nixosConfigurations` in `flake.nix`, or use `--flake /etc/nixos#nixos-test` to specify the configuration name.
After the installation, all user-level packages and configuration can be managed through `/etc/nixos/home.nix`. When running `sudo nixos-rebuild switch`, the configuration of home-manager will be applied automatically. (**It's not necessary to run `home-manager switch` manually**!)
To find the options we can use in `home.nix`, referring to the following documents:

View File

@ -217,6 +217,8 @@ nix flake new example -t github:nix-community/home-manager#nixos
然后执行 `sudo nixos-rebuild switch` 应用配置,即可完成 home-manager 的安装。
> 如果你的系统 Hostname 不是 `nixos-test`,你需要在 `flake.nix` 中修改 `nixosConfigurations` 的名称,或者使用 `--flake /etc/nixos#nixos-test` 来指定配置名称。
安装完成后,所有用户级别的程序、配置,都可以通过 `/etc/nixos/home.nix` 管理,并且执行 `sudo nixos-rebuild switch` 时也会自动应用 home-manager 的配置。
`home.nix` 中 Home Manager 的配置项有这几种查找方式: