Skip to content

Non-viable install plan chosen #979

@bgamari

Description

@bgamari

While trying to build cabal-install under haskel.nix I found that the following would not build:

let
  buildCabal = { pkgs }:
  let
    proj = pkgs.haskell-nix.project {
        projectFileName = "cabal.project";
        src = fetchGit {
          url = "https://github.com/haskell/cabal";
          rev = "0ee90d0b426d177c94cef9b2e23fe923dfe56508";
          ref = "3.4";
        };
        cabalProjectLocal = ''
          package lukko
            flags: -ofd-locking
        '';
        compiler-nix-name = "ghc8102"; # Not required for `stack.yaml` based projects.
        #packages = {
        #  lukko = {
        #    configureFlags = "-f-ofd-locking";
        #    components.library.configureFlags = "-f-ofd-locking";
        #  };
        #};
      };
    in proj.cabal-install.components.exes.cabal;

  #haskellNix = import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {};
  haskellNix = import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/0d072acf6e2acb9d5495a489d1e34d8736e5a847.tar.gz") {};
  nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
  pkgs = import nixpkgsSrc haskellNix.nixpkgsArgs;

  armv7l-musl-pkgs = import nixpkgsSrc (haskellNix.nixpkgsArgs // {
    crossSystem = pkgs.lib.systems.platforms.armv7l-hf-multiplatform // { config = "armv7l-unknown-linux-musleabihf"; };
  });
in {
  amd64 = buildCabal { pkgs = pkgs; };
  amd64-musl = buildCabal { pkgs = pkgs.pkgsCross.musl64; };
  aarch64 = buildCabal { pkgs = pkgs.pkgsCross.aarch64-multiplatform-musl; };
  armv7l = buildCabal { pkgs = pkgs.pkgsCross.armv7l-hf-multiplatform; };
  armv7l-musl = buildCabal { pkgs = armv7l-musl-pkgs; };
}

Trying to build the amd64 attribute fails with strange compilation errors that suggest it's building against the wrong Cabal version. Looking at the build log seems to confirm this:

configuring
Configure flags:                                                                                                                
--prefix=/nix/store/hk3w34rxihl9ds7saygbysskzxm5an59-cabal-install-exe-cabal-3.4.0.0 
exe:cabal --package-db=clear 
--package-db=/nix/store/4hb0jxkjirz8f9mvkrkgymp9kpz5c7hb-cabal-install-exe-cabal-3.4.0.0-config/lib/ghc-8.10.2/package.conf.d 
--flags=-debug-conflict-sets --flags=-debug-expensive-assertions 
--flags=-debug-tracetree --flags=lukko --flags=native-dns --exact-configuration 
--dependency=async=async-2.2.2-K0LmN1fF9zV1F0OSyCG5J0 
...
--dependency=Cabal=Cabal-3.2.0.0 --dependency=array=array-0.5.4.0 

Even stranger, examining amd64.buildInputs in nix repl shows that Cabal isn't even a build input:

nix-repl> amd64.buildInputs
«derivation /nix/store/1z3550m3j2ja1fcr2hbs01jn3v3vynwx-async-lib-async-2.2.2.drv»
«derivation /nix/store/jnip5aq0vvxygwjn65i2yv3v6q5fzyfw-base16-bytestring-lib-base16-bytestring-0.1.1.7.drv»
«derivation /nix/store/m7v5lsxl2klzgjsng08bm«derivation /nix/store/9ic2f1p8qbywg4vs2bqjyfv54z43hh4w-edit-distance-lib-edit-distance-0.2.2.1.drv»
«derivation /nix/store/sj6m89pl7fq1xj8vdbx7glkp3bp87bj5-hashable-lib-hashable-1.3.0.0.drv»
«derivation /nix/store/sr01iahkmi9qwxwv18jmpb3i8fk76c08-HTTP-lib-HTTP-4000.3.15.drv»
«derivation /nix/store/36ppl8fr2vbgjni51iz2slky2q2zw9j0-network-uri-lib-network-uri-2.6.3.0.drv»
«derivation /nix/store/c5zfjvv2q8zihkipddbqshbl2icq45mc-random-lib-random-1.2.0.drv»
«derivation /nix/store/rx36b0hwhky0ip3bspcj02shvd6l2ps0-stm-lib-stm-2.5.0.0.drv» 
«derivation /nix/store/0872rfs96kqdfkspv68fnidyiyi9myza-tar-lib-tar-0.5.1.1.drv»
 «derivation /nix/store/ga7l0dzajv9zjn5iw3k71j70mb74r5iq-zlib-lib-zlib-0.6.2.2.drv» 
«derivation /nix/store/ij5rzg4937440d62vm64v77ry7jbq1sc-hackage-security-lib-hackage-security-0.6.0.1.drv»
 «derivation /nix/store/vyrcm1fp656c1vvwq1n9id05l8qx4s9q-regex-base-lib-regex-base-0.94.0.0.drv»
«derivation /nix/store/xr5wyw4a2qxqlpia5sy6rlxf8pn0vvz4-regex-posix-lib-regex-posix-0.96.0.0.drv»
 «derivation /nix/store/knqmp9kkavab47jjbbsbc7kjq452a5m8-resolv-lib-resolv-0.1.2.0.drv»
 «derivation /nix/store/5hi2vfyrv1hjbbnahrdzmsrs5i60sx3w-lukko-lib-lukko-0.1.1.2.drv» ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions