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 #85446

Merged
merged 0 commits into from Apr 17, 2020

Conversation

guibou
Copy link
Contributor

@guibou guibou commented Apr 17, 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])

Then run /bin/ghci in the derivation and import PyF, it should import the module fine. I think I used PyF without any lose of generality.

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

Motivation for this change

Fixing GHC 8.10 ghcWithPackages which is currently not usable.

Things done

See above comments (Sorry, I did not realize that the template was after my commit message, so I submitted blindly)

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after) (0 changes)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@peti
Copy link
Member

peti commented Apr 17, 2020

Please target the haskell-updates branch for these kind of changes.

@peti peti changed the base branch from master to haskell-updates April 17, 2020 15:46
@peti peti merged this pull request into NixOS:haskell-updates Apr 17, 2020
@guibou guibou deleted the fix_ghcwithpackages_810 branch April 17, 2020 15:49
@seanparsons
Copy link
Contributor

@peti Is the intention that this fix wont make it into 20.03? As I'm still seeing it there with the latest that nix-prefetch-git gives me for that branch.

@peti
Copy link
Member

peti commented Jun 10, 2020

@seanparsons, I think it would be perfectly fine to port that PR to release-20.03. I see no downsides.

Shimuuar added a commit to hexresearch/hschain that referenced this pull request Dec 18, 2020
Unable to create shell. See NixOS/nixpkgs#85446
Shimuuar added a commit to hexresearch/hschain that referenced this pull request Jan 11, 2021
Unable to create shell. See NixOS/nixpkgs#85446
Shimuuar added a commit to hexresearch/hschain that referenced this pull request Jun 28, 2021
Unable to create shell. See NixOS/nixpkgs#85446
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.

ghcWithPackages wrapper does not work with ghc-8.10.1
3 participants