代码之家  ›  专栏  ›  技术社区  ›  nicolas

为什么nixflakeshow构建ghc?

  •  0
  • nicolas  · 技术社区  · 4 年前

    如果我看一下 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):.....
    

    从英特尔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)
    

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

    如果我在我拥有的其他薄片上运行此命令,在几次获取之后:

    ❯ 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
    
    0 回复  |  直到 3 年前
        1
  •  6
  •   Robert Hensing Nguyen Hoang Hiep    4 年前

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

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

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

    没有建筑就无法评估这些 bar somePackage

    haskell.nix 确实有一个功能可以让你完全避免这样的表达。他们称之为 materialization

    推荐文章