mirror of
https://github.com/ryan4yin/nixos-and-flakes-book
synced 2024-11-26 22:10:26 +00:00
fix: nixos-rebuild - specify flake's output name
This commit is contained in:
parent
be77a4008d
commit
221f20678c
2 changed files with 2 additions and 2 deletions
|
@ -162,7 +162,7 @@ Note that the copied template cannot be used directly. You need to modify it to
|
||||||
|
|
||||||
We defined a NixOS system called `nixos-test` with a configuration file at `./configuration.nix`, which is the classic configuration we modified before. Therefore, we can still make use of it.
|
We defined a NixOS system called `nixos-test` with a configuration file at `./configuration.nix`, which is the classic configuration we modified before. Therefore, we can still make use of it.
|
||||||
|
|
||||||
To apply the configuration to a system with hostname `nixos-test`, run `sudo nixos-rebuild switch`. No changes will be made to the system because we imported the old configuration file in `/etc/nixos/flake.nix`, so the actual state we declared remains unchanged.
|
To apply the configuration to a system with hostname `nixos-test`, run `sudo nixos-rebuild switch --flake /etc/nixos#nixos-test`. No changes will be made to the system because we imported the old configuration file in `/etc/nixos/flake.nix`, so the actual state we declared remains unchanged.
|
||||||
|
|
||||||
## Managing System Packages with Flakes
|
## Managing System Packages with Flakes
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ cat flake.nix
|
||||||
|
|
||||||
这里我们定义了一个名为 `nixos-test` 的系统,它的配置文件为 `./configuration.nix`,这个文件就是我们之前的配置文件,这样我们仍然可以沿用旧的配置。
|
这里我们定义了一个名为 `nixos-test` 的系统,它的配置文件为 `./configuration.nix`,这个文件就是我们之前的配置文件,这样我们仍然可以沿用旧的配置。
|
||||||
|
|
||||||
现在执行 `sudo nixos-rebuild switch` 应用配置,系统应该没有任何变化,因为我们仅仅是切换到了 Nix Flakes,配置内容与之前还是一致的。
|
现在执行 `sudo nixos-rebuild switch --flake /etc/nixos#nixos-test` 应用配置,系统应该没有任何变化,因为我们仅仅是切换到了 Nix Flakes,配置内容与之前还是一致的。
|
||||||
|
|
||||||
## 通过 Flakes 来管理系统软件 {#manage-system-software-with-flakes}
|
## 通过 Flakes 来管理系统软件 {#manage-system-software-with-flakes}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue