Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GHC 8.4 package overrides #34404

Merged
merged 1 commit into from Feb 6, 2018
Merged

GHC 8.4 package overrides #34404

merged 1 commit into from Feb 6, 2018

Conversation

deepfire
Copy link
Contributor

Motivation for this change

Supply a set of fixes to make more packages buildable with GHC 8.4-alpha2.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@deepfire
Copy link
Contributor Author

deepfire commented Jan 30, 2018

@peti, this PR is not yet intended for merging -- rather to gather your feedback.

Compared to the previous situation this set of overrides has:

  1. Trim of every non-essential override.
  2. Proof that every remaining property override is necessary -- citing the error messages during build, if the said property override is not provided.

This has been derived 95% automatically -- the remainder (just two overrides) was explained manually.

As I remember the previous conversation (in #34023), what remains to be done is:

(b) known to upstream,

This part only makes sense to satisfy if the fix hasn't been mainlined yet.

Thankfully, the automation I have right now is helpful enough to ease that filtering -- and supply classification otherwise -- if you look at the overrides, they are grouped in three four categories:

  1. on Hackage, waiting for import
  2. upstreamed, no Hackage release yet
  3. not upstreamed, with PR numbers
  4. non-code, configuration-only changes (jailbreaking, test disables etc.)

So.. I guess I'd appreciate any feedback you might have : -)

@deepfire deepfire changed the title WIP: ghc 8.4 overrides GHC 8.4 package overrides Jan 31, 2018
@deepfire
Copy link
Contributor Author

deepfire commented Jan 31, 2018

The point about upstream tracking is now satisfied: the PR URLs are supplied for those src overrides that are not upstreamed.

@deepfire deepfire force-pushed the x-ghc-8.4-overrides branch 2 times, most recently from 2a6299e to 2897a7f Compare January 31, 2018 01:26
## On Hackage:

blaze-markup = overrideCabal super.blaze-markup (drv: {
## On Hackage, awaiting for import
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be easier to use self.blaze-markup_0_8_2_0? The same applies to virtually all those overrides that update a package to the latest version. We have the latest version in Nixpkgs, and using those names has the advantage that evaluation will break every time these receive an update, which gives us a nudge to re-evaluate the situation and follow the update (or drop the overrive).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's also automatable to a sufficient extent -- will do!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@peti, I'm trying to replace the src-based override with these "shadow" attributes:

  hspec-core = overrideCabal super.hspec-core_2_4_7 (drv: {
    editedCabalFile = null;
  });

..and I'm getting:

FATAL:  failed to instantiate text-lens:  nix-instantiate packages.nix -A text-lens --argstr compiler ghc841 --show-trace
error: while evaluating the attribute ‘propagatedBuildInputs’ of the derivation ‘text-lens-0.1.1’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘propagatedBuildInputs’ of the derivation ‘lens-4.15.4’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildInputs’ of the derivation ‘base-orphans-0.6’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘propagatedBuildInputs’ of the derivation ‘hspec-2.4.7’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildInputs’ of the derivation ‘hspec-core-2.4.7’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildInputs’ of the derivation ‘silently-1.2.5’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildInputs’ of the derivation ‘temporary-1.2.1.1’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
while evaluating the attribute ‘buildInputs’ of the derivation ‘base-compat-0.9.3’ at /home/deepfire/src/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:148:11:
infinite recursion encountered, at undefined position

Am I doing something obviously wrong?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My guess is that overrideCabal cannot be used for those shadow attributes for some reason.. although I'm somewhat surprised, given how they are defined (same as normal, non-version-suffixed ones).

Copy link
Contributor Author

@deepfire deepfire Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a bit more context -- the construction I'm using is:

ghcOrig.override (oldArgs: {
    overrides = self: super:
    with haskellLib; with self; {
       ...
        hspec-core = overrideCabal super.hspec-core_2_4_7 (drv: {
            editedCabalFile = null;
        });
       ...
    };
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hspec packages are tricky because some of their dependencies depend on hspec for testing --- which causes infinite loops. The easiest way to avoid that issue is to disable the check phase of those packages, like I did in https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix#L46.

A better albeit more involved solution is to figure out which package is causing the recursion and to pass a dont-check-variant of that particular package to hspec during testing, like we do at https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/configuration-common.nix#L51-L52. We have those overrides for the default versions, but apparently we don't have them for the latest versions, which makes sense, I guess.

BTW, I'm wondering why you set

editedCabalFile = null;

in your override. That doesn't seem necessary to me?

Copy link
Contributor Author

@deepfire deepfire Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The editedCabalFile is coming from a pre-auto-trim state of the override set, but after I have promoted the package from github-overridden (where the editedCabalFile negation is necessary) to "hackaged" -- basically intermediate state, that's not intended as a final result.

Investigating now how to deal with the loops -- mainly how many instances of the problem can be dealt with doCheck = false..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done -- the use of versioned attributes is now automatic.

## from the context: (Monad m, Monoid a)
src = pkgs.fetchgit {
url = "https://github.com/ekmett/free";
rev = "fcefc71ed302f2eaf60f020046bad392338b3109";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this override be updated when a new release version of free comes out that supersedes this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question! -- I've added automation to the audit script to catch the override version lagging behind upstream to the update script. I'll update the override set tonight.

So the full answer is -- there are scripts that:

  1. automatically generate set trimming proposals, and
  2. audit the current override set for various invariants, like:
  • Nixpkgs-supplied packages lagging behind the Hackage-based overrides
  • Upstreamed-overridden version not lagging behind upstream master, in terms of Cabal version number
  • User-overridden version having a PR supplied and the PR not being merged
  • User-overridden version having the same Cabal version as upstream master

When I run the audit script and see any warnings, that means actions need to be taken.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, if you've automated these things, then that's a pretty good solution. :-) It would be great if you could provide a brief step-by-step write-up of how to run those scripts of yours so that I know how to run them, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern them being such a mess, I'm somewhat ashamed to bring them to light -- this is truly a case of exploratory chaos -- in bash..

That said, I'll close my eyes and still do this -- just give me a bit more time..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've mostly refactored the thing into a tolerable shape.

I guess a small test suite is what remains.

## • Could not deduce (Semigroup (IterT m a))
## arising from the superclasses of an instance declaration
## from the context: (Monad m, Monoid a)
src = pkgs.fetchgit {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use fetchGitHub instead of fetchgit? It's a minor optimization, granted, but fetchGitHub downloads a single tarball rather than fetching each file individually and is therefore more efficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Member

@peti peti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! I'd be happy to merge this PR. Let me know when all pending stages are pushed, please.

@deepfire
Copy link
Contributor Author

deepfire commented Feb 6, 2018

@peti, I believe I have addressed your suggestions.

I can't vouch 100% on the necessity of these overrides, since they are auto-generated, and there's lots of things to keep in mind -- heuristics can only go so far.

@peti peti merged commit a9268dd into NixOS:master Feb 6, 2018
@deepfire deepfire deleted the x-ghc-8.4-overrides branch February 6, 2018 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants