mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2025-06-22 13:01:25 +02:00
fix: style
This commit is contained in:
parent
fe6e315c9a
commit
9abb024ae4
@ -59,19 +59,22 @@ cat flake.nix
|
|||||||
Referencing this template, create the file `/etc/nixos/flake.nix` and write the configuration content. All subsequent system modifications will be taken over by Nix Flakes.
|
Referencing this template, create the file `/etc/nixos/flake.nix` and write the configuration content. All subsequent system modifications will be taken over by Nix Flakes.
|
||||||
Here's an example of the content:
|
Here's an example of the content:
|
||||||
|
|
||||||
```nix
|
```nix{16}
|
||||||
{
|
{
|
||||||
description = "A simple NixOS flake";
|
description = "A simple NixOS flake";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# NixOS official package source, using the nixos-23.11 branch here
|
# NixOS official package source, using the nixos-23.11 branch here
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, ... }@inputs: {
|
outputs = { self, nixpkgs, ... }@inputs: {
|
||||||
# Please replace my-nixos with your hostname
|
# Please replace my-nixos with your hostname
|
||||||
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
# Import the previous configuration.nix we used, so the old configuration file still takes effect
|
# Import the previous configuration.nix we used,
|
||||||
|
# so the old configuration file still takes effect
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -56,7 +56,7 @@ cat flake.nix
|
|||||||
|
|
||||||
我们参照该模板创建文件 `/etc/nixos/flake.nix` 并编写好配置内容,后续系统的所有修改都将全部由 Nix Flakes 接管,示例内容如下:
|
我们参照该模板创建文件 `/etc/nixos/flake.nix` 并编写好配置内容,后续系统的所有修改都将全部由 Nix Flakes 接管,示例内容如下:
|
||||||
|
|
||||||
```nix
|
```nix{16}
|
||||||
{
|
{
|
||||||
description = "A simple NixOS flake";
|
description = "A simple NixOS flake";
|
||||||
|
|
||||||
@ -70,7 +70,8 @@ cat flake.nix
|
|||||||
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
# 这里导入之前我们使用的 configuration.nix,这样旧的配置文件仍然能生效
|
# 这里导入之前我们使用的 configuration.nix,
|
||||||
|
# 这样旧的配置文件仍然能生效
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user