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

haskellPackages.ghcWithPackages: fix for GHC 8.10 #91999

Merged

Conversation

@ocharles
Copy link
Member

ocharles commented Jul 2, 2020

This closes #79441.

ghcWithPackages is using ghc-pkg recache to build its package
database. By doing so, it overrides the package.cache[.lock] files.

Details are unclear, but GHC 8.10 changed a bit the behavior.
Previously, it was unconditionally replacing the files by new ones. Now
it tries to open (for modification) the files. These files are symlinks
to another nix derivation, which is hence read-only.

This commit removes the files before running ghc-pkg recache, hence it
will just write the new files.

Tested with haskellPackages.ghcWithPackages (i.e. GHC 8.8) and
haskell.packages.ghc8101.ghcWithPackages (i.e GHC 8.10) with the
following nix file, at the root of the nixpkgs repository:

with import ./. {
  overlays = [
    (
      self: super: {
        haskellPackages = super.haskell.packages.ghc8101.override {
          overrides = selfh: superh: {
             th-lift-instances = super.haskell.lib.doJailbreak superh.th-lift-instances;
             th-expand-syns    = super.haskell.lib.doJailbreak superh.th-expand-syns;
             th-reify-many     = super.haskell.lib.doJailbreak superh.th-reify-many;
             th-orphans        = super.haskell.lib.doJailbreak superh.th-orphans;
             haskell-src-meta  = super.haskell.lib.doJailbreak superh.haskell-src-meta;
          };
        };
      }
  )
  ];
};
haskellPackages.ghcWithPackages(p:[p.PyF])

This will test with GHC 8.10. Comment out the overlays to test with
GHC 8.8.

@ocharles
Copy link
Member Author

ocharles commented Jul 2, 2020

This is building on my local Hydra - I will move it out of draft once the build completes.

@ocharles ocharles requested a review from peti Jul 2, 2020
@ocharles ocharles marked this pull request as ready for review Jul 2, 2020
@cdepillabout
Copy link
Member

cdepillabout commented Jul 3, 2020

@ocharles This is just a backport of abc4f96 to 20.03, right?

  1. Could you rebase this on the release-20.03 branch instead of nixos-20.03. I know the names sound like they should be opposite, but release-20.03 is the actual branch that things should be backported to. The nixos-20.03 branch just directly tracks the 20.03 channel. It is not possible to merge PRs into it.

  2. When backporting changes, can you make sure to use git cherry-pick -x? This makes it easier to track where cherry-picks came from for anyone looking through the history.

@ocharles
Copy link
Member Author

ocharles commented Jul 3, 2020

Ok, I'll get all that sorted now. This is indeed just a cherry pick of the commit as is in master with no changes

@ocharles
Copy link
Member Author

ocharles commented Jul 3, 2020

Ok, this will have to wait until next week as I'm travelling until Monday and I don't want to clone all of nixpkgs over mobile data 😆

This closes #79441.

ghcWithPackages is using `ghc-pkg recache` to build its package
database. By doing so, it overrides the `package.cache[.lock]` files.

Details are unclear, but GHC 8.10 changed a bit the behavior.
Previously, it was unconditionally replacing the files by new ones. Now
it tries to open (for modification) the files. These files are symlinks
to another nix derivation, which is hence read-only.

This commit removes the files before running `ghc-pkg recache`, hence it
will just write the new files.

Tested with `haskellPackages.ghcWithPackages` (i.e. GHC 8.8) and
`haskell.packages.ghc8101.ghcWithPackages` (i.e GHC 8.10) with the
following nix file, at the root of the nixpkgs repository:

```
with import ./. {
  overlays = [
    (
      self: super: {
        haskellPackages = super.haskell.packages.ghc8101.override {
          overrides = selfh: superh: {
             th-lift-instances = super.haskell.lib.doJailbreak superh.th-lift-instances;
             th-expand-syns    = super.haskell.lib.doJailbreak superh.th-expand-syns;
             th-reify-many     = super.haskell.lib.doJailbreak superh.th-reify-many;
             th-orphans        = super.haskell.lib.doJailbreak superh.th-orphans;
             haskell-src-meta  = super.haskell.lib.doJailbreak superh.haskell-src-meta;
          };
        };
      }
  )
  ];
};
haskellPackages.ghcWithPackages(p:[p.PyF])
```

This will test with GHC 8.10. Comment out the `overlays` to test with
GHC 8.8.

(cherry picked from commit abc4f96)
@ocharles ocharles force-pushed the circuithub:support-ghc-8.10-on-nixos-20.03 branch from 8202cfd to a078182 Jul 6, 2020
@ocharles ocharles changed the base branch from nixos-20.03 to release-20.03 Jul 6, 2020
@ocharles
Copy link
Member Author

ocharles commented Jul 6, 2020

@cdepillabout Ok, I think it's correct now!

@cdepillabout
Copy link
Member

cdepillabout commented Jul 6, 2020

@ocharles Thanks for fixing this up!

@cdepillabout cdepillabout merged commit 02203c1 into NixOS:release-20.03 Jul 6, 2020
16 checks passed
16 checks passed
Evaluation Performance Report Evaluator Performance Report
Details
crispyDoom, crispyDoom.passthru.tests, roundcube, roundcube.passthru.tests, tendermint, tendermint.passthru.tests on aarch64-linux Success
Details
crispyDoom, crispyDoom.passthru.tests, roundcube, roundcube.passthru.tests, tendermint, tendermint.passthru.tests on x86_64-linux Success
Details
grahamcofborg-eval ^.^!
Details
grahamcofborg-eval-check-maintainers matching changed paths to changed attrs...
Details
grahamcofborg-eval-check-meta config.nix: checkMeta = true
Details
grahamcofborg-eval-darwin nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./pkgs/t
Details
grahamcofborg-eval-lib-tests nix-build --arg pkgs import ./. {} ./lib/tests/release.nix
Details
grahamcofborg-eval-nixos nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./nixos/
Details
grahamcofborg-eval-nixos-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./nixos/
Details
grahamcofborg-eval-nixos-options nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./nixos/
Details
grahamcofborg-eval-nixpkgs-manual nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-tarball nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./pkgs/t
Details
grahamcofborg-eval-nixpkgs-unstable-jobset nix-instantiate --arg nixpkgs { outPath=./.; revCount=999999; shortRev="a078182"; rev="a078182158e566df9407e4b2a6efe50de2d5824b"; } ./pkgs/t
Details
grahamcofborg-eval-package-list nix-env -qa --json --file .
Details
grahamcofborg-eval-package-list-no-aliases nix-env -qa --json --file . --arg config { allowAliases = false; }
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.