srid / srid/haskell-flake

Architecture error when importing a dependency multiple times

Open
#431 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Nix
Stars
240
Forks
27
PR merge metrics
No merged PRs in 30d

Description

I have a flake that has the following dependencies:

Inputs:
├───flake-parts: github:hercules-ci/flake-parts/49f0870db23e8c1ca0b5259734a02cd9e1e371a1
│   └───nixpkgs-lib: github:nix-community/nixpkgs.lib/656a64127e9d791a334452c6b6606d17539476e2
├───haskell-flake: github:srid/haskell-flake/af2ba40f23824556b12d1cdfdf392e263876d644
├───nixpkgs: github:nixos/nixpkgs/8f1b52b04f2cb6e5ead50bd28d76528a2f0380ef
├───persistent-sqlite: git+https://code.vergara.tech/Vergara_Tech/persistent-sqlite?ref=master&rev=4ecc955c183dfacfb4c41b9de04c336dab0ca768
│   ├───flake-parts follows input 'flake-parts'
│   ├───haskell-flake follows input 'haskell-flake'
│   └───nixpkgs follows input 'nixpkgs'
├───qrc: git+https://code.vergara.tech/Vergara_Tech/qrc?ref=master&rev=9554d32f8ab4e26d568d1eda46ace907b896a1b4
│   ├───crane: github:ipetkov/crane/323b5746d89e04b22554b061522dfce9e4c49b18
│   ├───flake-parts follows input 'flake-parts'
│   ├───foreign-rust: git+https://code.vergara.tech/Vergara_Tech/haskell-foreign-rust?ref=main&rev=6366ca7b0f9a3c0b71bee88ae396393e692852ad
│   │   ├───borsh: git+https://code.vergara.tech/Vergara_Tech/borsh.git?ref=main&rev=8d45db7fdce9a8b5b5f73ec550f1e8c17650c341
│   │   │   ├───flake-parts follows input 'qrc/foreign-rust/flake-parts'
│   │   │   ├───haskell-flake follows input 'qrc/foreign-rust/haskell-flake'
│   │   │   └───nixpkgs follows input 'qrc/foreign-rust/nixpkgs'
│   │   ├───crane: github:ipetkov/crane/323b5746d89e04b22554b061522dfce9e4c49b18
│   │   ├───flake-parts follows input 'qrc/flake-parts'
│   │   ├───haskell-flake follows input 'qrc/haskell-flake'
│   │   ├───nixpkgs follows input 'qrc/nixpkgs'
│   │   └───rust-overlay follows input 'qrc/rust-overlay'
│   ├───haskell-flake follows input 'haskell-flake'
│   ├───nixpkgs follows input 'nixpkgs'
│   └───rust-overlay: github:oxalica/rust-overlay/12419593ce78f2e8e1e89a373c6515885e218acb
│       └───nixpkgs follows input 'qrc/nixpkgs'
└───zcash-haskell: git+https://code.vergara.tech/Vergara_Tech/zcash-haskell?ref=ravnix&rev=3d1eb7e44ea473a69e62402f93cdfd3ad5a12506
    ├───crane: github:ipetkov/crane/323b5746d89e04b22554b061522dfce9e4c49b18
    ├───flake-parts follows input 'flake-parts'
    ├───haskell-flake follows input 'haskell-flake'
    ├───hexstring: git+https://code.vergara.tech/Vergara_Tech/haskell-hexstring?ref=master&rev=dd8c129b3e75c3d27ea596699b5a43ad0547f0e2
    │   ├───flake-parts follows input 'zcash-haskell/flake-parts'
    │   ├───foreign-rust: git+https://code.vergara.tech/Vergara_Tech/haskell-foreign-rust?ref=main&rev=6366ca7b0f9a3c0b71bee88ae396393e692852ad
    │   │   ├───borsh: git+https://code.vergara.tech/Vergara_Tech/borsh.git?ref=main&rev=8d45db7fdce9a8b5b5f73ec550f1e8c17650c341
    │   │   │   ├───flake-parts follows input 'zcash-haskell/hexstring/foreign-rust/flake-parts'
    │   │   │   ├───haskell-flake follows input 'zcash-haskell/hexstring/foreign-rust/haskell-flake'
    │   │   │   └───nixpkgs follows input 'zcash-haskell/hexstring/foreign-rust/nixpkgs'
    │   │   ├───crane: github:ipetkov/crane/323b5746d89e04b22554b061522dfce9e4c49b18
    │   │   ├───flake-parts follows input 'zcash-haskell/hexstring/flake-parts'
    │   │   ├───haskell-flake follows input 'zcash-haskell/hexstring/haskell-flake'
    │   │   ├───nixpkgs follows input 'zcash-haskell/hexstring/nixpkgs'
    │   │   └───rust-overlay: github:oxalica/rust-overlay/c52e346aedfa745564599558a096e88f9a5557f9
    │   │       └───nixpkgs follows input 'zcash-haskell/hexstring/foreign-rust/nixpkgs'
    │   ├───haskell-flake follows input 'zcash-haskell/haskell-flake'
    │   └───nixpkgs follows input 'zcash-haskell/nixpkgs'
    ├───nixpkgs follows input 'nixpkgs'
    └───rust-overlay: github:oxalica/rust-overlay/12419593ce78f2e8e1e89a373c6515885e218acb
        └───nixpkgs follows input 'zcash-haskell/nixpkgs'

When running nix flake check I get this error:

error: a 'aarch64-darwin' with features {} is required to build '/nix/store/wprydkf14qwvnnyz8vvhbn7rbhchr8rz-cabal2nix-borsh.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test, uid-range}

I am importing these libraries into the main flake like this:

    flake-parts.lib.mkFlake {inherit inputs;} {
      systems = nixpkgs.lib.systems.flakeExposed;
      imports = [
        inputs.haskell-flake.flakeModule
      ];

      perSystem = {
        self',
        config,
        pkgs,
        inputs',
        system,
        ...
      }: {
        haskellProjects.default = {
          imports = [
            inputs.zcash-haskell.haskellFlakeProjectModules.output
            inputs.persistent-sqlite.haskellFlakeProjectModules.output
            inputs.qrc.haskellFlakeProjectModules.output
          ];
        ...
       };

The new addition is the qrc library and I don't understand why this is causing nix to try to build the wrong architecture for borsh. All these flakes pass their checks and build correctly on their own.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with nix flake check from the main flake and inspect the perSystem Haskell project imports for zcash-haskell, persistent-sqlite, and qrc. Trace the qrc dependency path through foreign-rust and borsh, focusing on why cabal2nix-borsh.drv requests aarch64-darwin on x86_64-linux. Done means the architecture mismatch is explained and the relevant flake checks behave consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.