Skip to content

Commit

Permalink
haskell.packages.ghc9{6,8}: work around aarch64-darwin output cycles
Browse files Browse the repository at this point in the history
This ports our infamous patch for `Cabal` which cheesily prevents an
output cycle for derivations that use separate bin outputs where
references caused by the `Paths_*` module can't be eliminated by the GHC
aarch64-darwin codegen backend.

See also

- the original issue NixOS#140774,
- the original patch for GHC 9.2 NixOS#216857
- the ported patch for GHC 9.4
  NixOS@f6f780f

Co-authored-by: sternenseemann <[email protected]>
  • Loading branch information
mpscholten and sternenseemann committed Dec 12, 2023
1 parent e1f9606 commit ad424bf
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.2.4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.2.5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.2.6.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.2.7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.2.8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.6.nix
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/ghc/9.4.8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ stdenv.mkDerivation (rec {
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-3.6-3.8-paths-fix-cycle-aarch64-darwin.patch
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = "patchShebangs .";
Expand Down
9 changes: 9 additions & 0 deletions pkgs/development/compilers/ghc/common-hadrian.nix
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,16 @@ stdenv.mkDerivation ({
(if lib.versionAtLeast version "9.8"
then ./docs-sphinx-7-ghc98.patch
else ./docs-sphinx-7.patch )
] ++ lib.optionals (stdenv.targetPlatform.isDarwin && stdenv.targetPlatform.isAarch64) [
# Prevent the paths module from emitting symbols that we don't use
# when building with separate outputs.
#
# These cause problems as they're not eliminated by GHC's dead code
# elimination on aarch64-darwin. (see
# https://github.com/NixOS/nixpkgs/issues/140774 for details).
./Cabal-at-least-3.6-paths-fix-cycle-aarch64-darwin.patch
];

postPatch = ''
patchShebangs --build .
'';
Expand Down

0 comments on commit ad424bf

Please sign in to comment.