mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-01-15 18:38:17 +01:00
fix: nixos-rebuild
This commit is contained in:
parent
3d9ec06790
commit
baed45353c
@ -237,6 +237,8 @@ Next, update `configuration.nix` to install `helix` from the `helix` input:
|
||||
|
||||
To deploy the changes, run `sudo nixos-rebuild switch`. After that, you can start the Helix editor by running the `hx` command.
|
||||
|
||||
> 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.
|
||||
|
||||
## Adding Custom Cache Mirrors
|
||||
|
||||
> If you don't need to customize the cache mirror, you can safely skip this section.
|
||||
@ -301,3 +303,5 @@ This is a security limitation of Nix, where only trusted users can properly use
|
||||
Now, to apply the configuration and make it effective, use `sudo nixos-rebuild switch`.
|
||||
Nix will prioritize searching for cached packages from the domestic mirror source after the switch.
|
||||
|
||||
> 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.
|
||||
|
||||
|
@ -219,6 +219,8 @@ cat flake.nix
|
||||
|
||||
改好后再 `sudo nixos-rebuild switch` 部署,就能安装好 helix 程序了,可直接在终端使用 `hx` 命令测试验证。
|
||||
|
||||
> 如果你的系统 Hostname 不是 `nixos-test`,你需要在 `flake.nix` 中修改 `nixosConfigurations` 的名称,或者使用 `--flake /etc/nixos#nixos-test` 来指定配置名称。
|
||||
|
||||
## 为 Flake 添加自定义 cache 源 {#add-cache-source-for-flake}
|
||||
|
||||
> 注意:这里介绍的手段只能加速部分包的下载,许多 inputs 数据源仍然会从 Github 拉取。
|
||||
@ -284,6 +286,8 @@ warning: ignoring untrusted substituter 'https://mirrors.ustc.edu.cn/nix-channel
|
||||
|
||||
现在再使用 `sudo nixos-rebuild switch` 应用配置即可生效,后续所有的包都会优先从国内镜像源查找缓存。
|
||||
|
||||
> 如果你的系统 Hostname 不是 `nixos-test`,你需要在 `flake.nix` 中修改 `nixosConfigurations` 的名称,或者使用 `--flake /etc/nixos#nixos-test` 来指定配置名称。
|
||||
|
||||
## 通过本地 HTTP 代理加速包下载 {#use-local-http-proxy-to-speed-up-nix-package-download}
|
||||
|
||||
虽然前面提到了,旁路由可以完全解决 NixOS 的包下载速度问题,但是旁路由的配置比较麻烦,而且经常需要额外的软路由设备支持。
|
||||
|
Loading…
Reference in New Issue
Block a user