Flakes/zh: Difference between revisions
No edit summary |
Updating to match new version of source page |
||
| (4 intermediate revisions by one other user not shown) | |||
| Line 17: | Line 17: | ||
description = "A very basic flake"; | description = "A very basic flake"; | ||
inputs = { | inputs = { | ||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; | ||
}; | }; | ||
outputs = { self, nixpkgs }: { | outputs = { self, nixpkgs }: { | ||
packages.x86_64-linux = { | |||
packages.x86_64-linux | default = self.packages.x86_64-linux.hello; | ||
hello = nixpkgs.legacyPackages.x86_64-linux.hello; | |||
}; | |||
}; | }; | ||
}</nowiki>|name=flake.nix|lang=nix}} | }</nowiki>|name=flake.nix|lang=nix}} | ||
| Line 197: | Line 196: | ||
<code>inputs.nixpkgs.url = "github:NixOS/nixpkgs/<branch name>";</code> | <code>inputs.nixpkgs.url = "github:NixOS/nixpkgs/<branch name>";</code> | ||
Nixpkgs 也可以指向一个由 NixOS 组织缓存的 URL: | |||
Nixpkgs | |||
<code>inputs.nixpkgs.url = "<nowiki>https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz</nowiki>";</code> | <code>inputs.nixpkgs.url = "<nowiki>https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz</nowiki>";</code> | ||
< | 在此示例中,输入将指向 <code>nixpkgs-unstable</code> 频道(channel)。 | ||
</ | |||
对于任何包含 flake.nix 文件的仓库,其所属网站也必须被定义。Nix 知道 nixpkgs 仓库的位置,因此没有必要声明它在 GitHub 上。 | 对于任何包含 flake.nix 文件的仓库,其所属网站也必须被定义。Nix 知道 nixpkgs 仓库的位置,因此没有必要声明它在 GitHub 上。 | ||
| Line 509: | Line 504: | ||
{{references}} | {{references}} | ||
[[Category:Software|软件]] | |||
[[Category:Nix|Nix]] | |||
[[Category:Nix Language|Nix 语言]] | |||
[[Category:Flakes|Flakes]] | |||