diff --git a/docs/nixos-with-flakes/nixos-with-flakes-enabled.md b/docs/nixos-with-flakes/nixos-with-flakes-enabled.md index 3b11aa4..a440b1e 100644 --- a/docs/nixos-with-flakes/nixos-with-flakes-enabled.md +++ b/docs/nixos-with-flakes/nixos-with-flakes-enabled.md @@ -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. Here's an example of the content: -```nix +```nix{16} { description = "A simple NixOS flake"; + inputs = { # NixOS official package source, using the nixos-23.11 branch here nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; }; + outputs = { self, nixpkgs, ... }@inputs: { # Please replace my-nixos with your hostname nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; 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 ]; }; diff --git a/docs/zh/nixos-with-flakes/nixos-with-flakes-enabled.md b/docs/zh/nixos-with-flakes/nixos-with-flakes-enabled.md index eb92576..9584dec 100644 --- a/docs/zh/nixos-with-flakes/nixos-with-flakes-enabled.md +++ b/docs/zh/nixos-with-flakes/nixos-with-flakes-enabled.md @@ -56,7 +56,7 @@ cat flake.nix 我们参照该模板创建文件 `/etc/nixos/flake.nix` 并编写好配置内容,后续系统的所有修改都将全部由 Nix Flakes 接管,示例内容如下: -```nix +```nix{16} { description = "A simple NixOS flake"; @@ -70,7 +70,8 @@ cat flake.nix nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ - # 这里导入之前我们使用的 configuration.nix,这样旧的配置文件仍然能生效 + # 这里导入之前我们使用的 configuration.nix, + # 这样旧的配置文件仍然能生效 ./configuration.nix ]; };