NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.45k stars 13.65k forks source link

Problem installing hfmt #31568

Closed srghma closed 1 year ago

srghma commented 6 years ago

Issue description & Steps to reproduce

 ✘  ~/.config/dotfiles   master ●✚  nix-shell --pure -p haskellPackages.hfmt
...
Warning: This package indirectly depends on multiple versions of the same
package. This is highly likely to cause a compile failure.
package stylish-haskell-0.8.1.0 requires haskell-src-exts-1.18.2
package hlint-2.0.9 requires haskell-src-exts-1.18.2
package hindent-5.2.3 requires haskell-src-exts-1.19.1
package hfmt-0.1.1 requires haskell-src-exts-1.19.1
....
*** abort because of serious configure-time warning from Cabal

What I have to change here?

  nixpkgs.config.packageOverrides = super: {
    haskellPackages = super.haskellPackages.override {
      overrides = self: super_: {
        "hfmt" = super_."hfmt".overrideDerivation (attrs: rec {
            ....
        });
      };
    };
  };
ryantm commented 6 years ago

hfmt still does not build on ghc843 or ghc861.

ryantm commented 6 years ago

@srghma Is nixfmt related to hfmt?

gilligan commented 5 years ago

I just wanted to give hfmt a try and then ended up here. On master it currently fails because of conflicting dependencies of haskell-src-exts:

    This package indirectly depends on multiple versions of the same package. This is very likely to cause a compile failure.
      package stylish-haskell (stylish-haskell-0.9.2.1-9XVxKbqExzZIs60m7h6SJq) requires haskell-src-exts-1.20.3-2fryh11Yuz7lCtLeeIQn8
      package hindent (hindent-5.2.7-T34fxFcJkHDcL33Jd8JpN) requires haskell-src-exts-1.20.3-2fryh11Yuz7lCtLeeIQn8
      package hlint (hlint-2.1.12-7gLWLmnjZwq2QaEd4NwRlO) requires haskell-src-exts-1.21.0-1MqMUIJU7y29AVS9NHxlR4
      package hfmt (hfmt-0.2.3.1) requires haskell-src-exts-1.21.0-1MqMUIJU7y29AVS9NHxlR4
      package haskell-src-exts-util (haskell-src-exts-util-0.2.4-JnBKmaPXKhRJ6qhckXKvij) requires haskell-src-exts-1.21.0-1MqMUIJU7y29AVS9N

I did try to ignore the error using allowInconsistentDependencies but it does indeed yield a compile error.

infinisil commented 5 years ago

This overlay fixes it for now (tested on 19.03), put this in ~/.config/nixpkgs/overlays/hfmt-fix.nix:

self: super: let
  hlib = super.haskell.lib;
in {

  haskellPackages = super.haskellPackages.override (old: {
    overrides = super.lib.composeExtensions (old.overrides or (self: super: {}))
      (hself: hsuper: {

        hfmt = hlib.dontCheck (hlib.overrideCabal (hsuper.hfmt.override {
          stylish-haskell = hlib.doJailbreak (hself.stylish-haskell.override {
            haskell-src-exts = hself.haskell-src-exts_1_21_0;
          });
          hindent = hlib.appendPatch (hself.hindent.override {
            haskell-src-exts = hself.haskell-src-exts_1_21_0;
          }) (super.fetchpatch {
            # From https://github.com/chrisdone/hindent/pull/537
            # to fix with haskell-src-exts >=1.21
            url = "https://github.com/felixonmars/hindent/commit/ce033ca1087b6155315eefe5a3e8ba6f29d1b76c.patch";
            sha256 = "0rpdhf2qmi6i37s88qb4z2lj2zidq2k5q38xgagffx2y6kcyphkz";
          });
        }) (drv: {
          broken = false;
        }));

      });
  });

}
stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
cdepillabout commented 1 year ago

As far as I know, people are generally not using hfmt anymore, so I'll go ahead and close. If you're still stuck on this, feel free to post a comment and we can re-open.