Main public logs
Appearance
Combined display of all available logs of Official NixOS Wiki. You can narrow down the view by selecting a log type, the username (case-sensitive), or the affected page (also case-sensitive).
- 19:30, 28 August 2025 Weijia talk contribs created page Translations:Flakes/214/zh (Created page with "outputs = { self, nixpkgs }: let systems = [ "x86_64-linux" "aarch64-linux" ]; forAllSystems = f: builtins.listToAttrs (map (system: { name = system; value = f system; }) systems); in { packages = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in { hello = pkgs.hello; default = pkgs.hello; }); }; } </syntaxhighlight>")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/213/zh (Created page with "inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; };")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/212/zh (Created page with "<syntaxhighlight lang="nix"> { description = "针对多种架构的 flake";")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/211/zh (Created page with "Flakes 强制要求您为每种支持的架构指定一个程序。以下示例展示了如何编写一个针对多种架构的 flake。")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/210/zh (Created page with "=== 为多架构定义 Flake ===")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/209/zh (Created page with "* <code>builtins.getEnv</code> 函数也是不纯的。请避免从环境变量中读取数据,同样,也不要引用 flake 目录之外的文件。")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/156/zh (Created page with "* <code>builtins.currentSystem</code> 函数是非确定且不纯的,因为它反映了执行推导的主机系统。通常可以通过将系统类型(例如 x86_64-linux)显式传递给需要它的 Derivations 来避免这种情况。")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/62/zh (Created page with "* {{Nixpkgs Manual|name=fetchurl|anchor=#sec-pkgs-fetchers-fetchurl-inputs}} 和 {{Nixpkgs Manual|name=fetchzip|anchor=#sec-pkgs-fetchers-fetchzip-inputs}} 需要传入 <code>sha256</code> 参数才会被视为纯函数。")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/61/zh (Created page with "Nix Flakes 在纯粹推导模式下进行,这意味着对于外部环境的访问被限制以确保可复现性。要保持使用 Flakes 时的纯粹性(Purity),请考虑以下方式:")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/60/zh (Created page with "=== 使您的推导更纯 ===")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/208/zh (Created page with "== 核心使用模式 ==")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/48/zh (Created page with "您还可以定义其他任意属性,但以上这些是 Nix 已知的输出。")
- 19:29, 28 August 2025 Weijia talk contribs created page Translations:Flakes/154/zh (Created page with "* <code><store-path></code> 是 <code>/nix/store..</code> 的路径。")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/153/zh (Created page with "* <code><flake></code> 是一个 flake 名称, 如“nixpkgs”。")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/152/zh (Created page with "* <code><name></code> 是一个属性名称,如“hello”。")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/45/zh (Created page with "* <code><system></code> 为类似“x86_64-linux”、“aarch64-linux”、“i686-linux”、“x86_64-darwin”的值")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/44/zh (Created page with "其中:")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/43/zh (Created page with "一旦 Inputs 被解析,它们就会与 <code>self</code> 一起传递给函数 <code>outputs</code>,<code>self</code> 是此 flake 在 Store 中的目录。<code>outputs</code> 根据以下规范返回 flake 的输出。")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/42/zh (Created page with "=== 输出规范 ===")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/207/zh (Created page with "<syntaxhighlight lang="nix"> inputs.self.submodules = true; </syntaxhighlight>")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/206/zh (Created page with "默认情况下,包 <code>src</code> 中的 Git 子模块不会被复制到 Nix Store,这可能会导致构建失败。Git 仓库中的 Flakes 可以声明它们需要启用 Git 子模块。从 Nix 版本 [https://discourse.nixos.org/t/nix-2-27-0-released/62003 2.27] 开始,您可以通过以下方式启用子模块:")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/41/zh (Created page with "使用大括号 ({}),我们可以缩短这些内容并将其放在一个表中。代码如下所示:")
- 19:28, 28 August 2025 Weijia talk contribs created page Translations:Flakes/39/zh (Created page with "如果您想让 Hyprland 的 nixpkgs 依赖跟随 nixpkgs 输入以避免出现多个版本的 nixpkgs,可以使用以下代码来完成:")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/37/zh (Created page with "例如,将 Hyprland 添加为输入看起来像这样:")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/36/zh (Created page with "对于任何包含 flake.nix 文件的仓库,其所属网站也必须被定义。Nix 知道 nixpkgs 仓库的位置,因此没有必要声明它在 GitHub 上。")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/34/zh (Created page with "Nixpkgs 可使用以下代码进行定义:")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/33/zh (Created page with "<code>inputs</code> 属性定义了 flake 的依赖项。例如,为了让系统能够正确构建,nixpkgs 必须被定义为系统 flake 的依赖项。")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/150/zh (Created page with "[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references Nix flake 引用手册].")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/32/zh (Created page with "[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-inputs Nix flake inputs 手册].")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/31/zh (Created page with "=== 输入规范 ===")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/149/zh (Created page with "* <code>nixConfig</code>:一个属性集,包含了 [https://nixos.org/manual/nix/stable/command-ref/conf-file.html 赋予 nix.conf 的值]。这可以通过添加特定于 flake 的配置(例如 二进制缓存源)来扩展用户 nix 操作的正常行为。")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/148/zh (Created page with "* <code>outputs</code>: 一个接收参数的函数,其参数为所有所需输入的属性集,并输出另一个属性集,其规范如下所述。")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/147/zh (Created page with "* <code>inputs</code>:一个包含此 flake 所有依赖项的属性集。相关规范见下述内容。")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/30/zh (Created page with "* <code>description</code>:描述此 flake 的字符串。")
- 19:27, 28 August 2025 Weijia talk contribs created page Translations:Flakes/29/zh (Created page with "它有 4 个顶级属性:")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/28/zh (Created page with "<code>flake.nix</code> 文件是一个具有特殊限制的 Nix 文件(稍后会详细介绍)。")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/27/zh (Created page with "== Flake 规范 ==")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/205/zh (Created page with "同样,您可以给 <code>run</code> 命令:<code>nix run .#hello</code> 和 <code>develop</code>命令:<code>nix develop .#hello</code>指定属性。")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/204/zh (Created page with "<syntaxHighlight lang=console> $ nix build .#hello </syntaxHighlight>")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/103/zh (Created page with "运行 <code>nix build</code> 将在 <code>legacyPackages</code> 和 <code>packages</code> 输出属性中查找相应的 derivation,然后基于您的系统架构构建默认输出项。如果您想在 flake 仓库中指定构建属性,可以运行 <code>nix build .#<attr></code>。在上面的示例中,如果您想构建 <code>packages.x86_64-linux.hello</code> 属性,请运行:")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/102/zh (Created page with "==== 在 flake 仓库中构建特定属性 ====")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/203/zh (Created page with "{{note|使用 nix develop 命令进入开发 shell 无需定义 devShell。 如果未定义 devShell,nix develop 命令会将您带入一个包含 flake 默认构建依赖项(如果有)的环境。}}")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/202/zh (Created page with "<syntaxhighlight lang="console"> $ nix develop </syntaxhighlight>")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/201/zh (Created page with "进入开发环境 Shell:")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/200/zh (Created page with "outputs = { self, nixpkgs}: let system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; }; in { devShells.x86_64-linux.default = pkgs.mkShell { buildInputs = with pkgs; [ hello ]; shellHook = '' echo "欢迎进入 devShell!" ''; }; }; } </syntaxhighlight>")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/199/zh (Created page with "inputs.nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/198/zh (Created page with "<syntaxhighlight lang="nix"> { description = "带有 devShell 的示例 flake";")
- 19:26, 28 August 2025 Weijia talk contribs created page Translations:Flakes/197/zh (Created page with "<code>devShell</code> 是定义在 flake 中由 Nix 提供的开发环境。它允许您声明一个可复用的 Shell 环境,其中将包含开发特定项目所需的工具、库和环境变量。这相当于在 flake 中定义一个 <code>nix-shell</code>。")
- 19:25, 28 August 2025 Weijia talk contribs created page Translations:Flakes/196/zh (Created page with "==== 开发环境 Shell ====")
- 19:25, 28 August 2025 Weijia talk contribs created page Translations:Flakes/195/zh (Created page with "<syntaxhighlight lang="console"> $ nix flake show └───packages └───x86_64-linux ├───default: package 'hello-2.12.2' └───hello: package 'hello-2.12.2' </syntaxhighlight>")