gpt4 book ai didi

haskell - 为什么 `nix flake show` 构建 ghc?

转载 作者:行者123 更新时间:2023-12-02 18:19:49 24 4
gpt4 key购买 nike

如果我查看 haskell.nix 提供的输出从 M1 计算机上剥落,它开始构建 ghc-8.8.4 等。

❯ nix flake show github:input-output-hk/haskell.nix
github:input-output-hk/haskell.nix/1b54ea01568299a0eda578ae9395e20d5c699ee1
├───checks
│ ├───aarch64-darwin
trace: haskell-nix.haskellLib.cleanGit: /nix/store/jmx2m0ldgrjq7p3gb4yyca47nvbvspfl-source does not seem to be a git repository,
assuming it is a clean checkout.
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!
trace: WARNING: No materialized dummy-ghc-data for ghc-8.8.4-aarch64-darwin.
trace: To make this a fixed-output derivation but not materialized, set `sha256` to the output of the 'calculateMaterializedSha' script in 'passthru'.
trace: To materialize this entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.
[1/0/579 built, 0.1 MiB DL] building ghc-8.8.4 (buildPhase):.....

从 Intel Mac,我得到

❯ nix flake show github:input-output-hk/haskell.nix
github:input-output-hk/haskell.nix/1b54ea01568299a0eda578ae9395e20d5c699ee1
├───checks
│ ├───aarch64-darwin
trace: haskell-nix.haskellLib.cleanGit: /nix/store/jmx2m0ldgrjq7p3gb4yyca47nvbvspfl-source does not seem to be a git repository,
assuming it is a clean checkout.
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!
trace: No index state specified for haskell-project, using the latest index state that we know about (2022-02-07T00:00:00Z)!
error: --- Error ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- nix
a 'aarch64-darwin' with features {} is required to build '/nix/store/sc11rh4l348yw3z4q4fy4byw324nm5yz-nix-tools-plan-to-nix-pkgs.drv', but I am a 'x86_64-darwin' with features {benchmark, big-parallel, nixos-test, recursive-nix}
(use '--show-trace' to show detailed location information)

为什么这些 flakes 需要构建任何东西来显示它们的输出?

如果我在其他一些 flake 上运行这个命令,在几次提取之后:

❯ nix flake show github:edolstra/dwarffs
github:edolstra/dwarffs/69d73417d83ebeb7711912e33515d87049b39de0
├───checks
│ ├───aarch64-linux
│ │ ├───build: derivation 'dwarffs-0.1.20220128.69d7341'
│ │ └───test: derivation 'vm-test-run-unnamed'
│ ├───i686-linux
│ │ ├───build: derivation 'dwarffs-0.1.20220128.69d7341'
│ │ └───test: derivation 'vm-test-run-unnamed'
│ └───x86_64-linux
│ ├───build: derivation 'dwarffs-0.1.20220128.69d7341'
│ └───test: derivation 'vm-test-run-unnamed'
├───defaultPackage
│ ├───aarch64-linux: package 'dwarffs-0.1.20220128.69d7341'
│ ├───i686-linux: package 'dwarffs-0.1.20220128.69d7341'
│ └───x86_64-linux: package 'dwarffs-0.1.20220128.69d7341'
├───nixosModules
│ └───dwarffs: NixOS module
└───overlay: Nixpkgs overlay

最佳答案

haskell.nix 很大程度上依赖于通常所说的“从派生导入”或 IFD。这些表达式如

foo = import "${mkDerivation bar}/expr.nix";

qux = builtins.readFile (somePackage + "/data.json");

如果不构建 barsomePackage,就无法评估这些。

haskell.nix 确实有一个功能可以让您完全避免此类表达式。他们称它为materialization .

关于haskell - 为什么 `nix flake show` 构建 ghc?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71024089/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com