Skip to content

Commit

Permalink
treewide: no justStaticExecutables on aarch64-darwin for bogus refs
Browse files Browse the repository at this point in the history
This commit disables justStaticExecutables for packages on
aarch64-darwin that incur a (usually incorrect) reference on GHC.
justStaticExecutables now fails when a GHC reference remains in the
output (#304352). Due to this reference justStaticExecutables (before
these changes) would only marginally reduce closure size.

In the future, we'll be able to re-introduce justStaticExecutables
after (manually) removing the incorrect references stemming from the use
of Paths_* modules. Tracking Issue: #318013
  • Loading branch information
sternenseemann committed Jun 8, 2024
1 parent 26e3a02 commit d785f11
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ let
makeWrapper $out/libexec/hci $out/bin/hci --prefix PATH : ${lib.escapeShellArg (makeBinPath bundledBins)}
'';
})
(addBuildTools [ makeWrapper ] (justStaticExecutables (haskellPackages.hercules-ci-cli.override overrides)));
(addBuildTools [ makeWrapper ]
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
((if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
(haskellPackages.hercules-ci-cli.override overrides)));
in pkg // {
meta = pkg.meta // {
position = toString ./default.nix + ":1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ let
makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${lib.escapeShellArg (makeBinPath bundledBins)}
'';
})
(addBuildTools [ makeBinaryWrapper ] (justStaticExecutables haskellPackages.hercules-ci-agent));
(addBuildTools [ makeBinaryWrapper ]
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
((if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.hercules-ci-agent));
in pkg.overrideAttrs (finalAttrs: o: {
meta = o.meta // {
position = toString ./default.nix + ":1";
Expand Down
36 changes: 29 additions & 7 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15922,7 +15922,10 @@ with pkgs;

cabal-install = haskell.lib.compose.justStaticExecutables haskellPackages.cabal-install;

stack = haskell.lib.compose.justStaticExecutables haskellPackages.stack;
stack =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.stack;

hlint = haskell.lib.compose.justStaticExecutables haskellPackages.hlint;

Expand Down Expand Up @@ -18831,7 +18834,10 @@ with pkgs;
guile = guile_2_2;
};

hadolint = haskell.lib.compose.justStaticExecutables haskellPackages.hadolint;
hadolint =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.hadolint;

halfempty = callPackage ../development/tools/halfempty { };

Expand Down Expand Up @@ -19132,7 +19138,10 @@ with pkgs;

msitools = callPackage ../development/tools/misc/msitools { };

haskell-ci = haskell.lib.compose.justStaticExecutables haskellPackages.haskell-ci;
haskell-ci =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.haskell-ci;

nailgun = callPackage ../development/tools/nailgun { };

Expand Down Expand Up @@ -19488,7 +19497,10 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) Security;
};

shake = haskell.lib.compose.justStaticExecutables haskellPackages.shake;
shake =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.shake;

shallot = callPackage ../tools/misc/shallot { };

Expand Down Expand Up @@ -20581,6 +20593,7 @@ with pkgs;

elfio = callPackage ../development/libraries/elfio { };

# TODO: Fix references and add justStaticExecutables https://github.com/NixOS/nixpkgs/issues/318013
emanote = haskellPackages.emanote;

enchant2 = callPackage ../development/libraries/enchant/2.x.nix { };
Expand Down Expand Up @@ -23215,7 +23228,10 @@ with pkgs;

matio = callPackage ../development/libraries/matio { };

matterhorn = haskell.lib.compose.justStaticExecutables haskellPackages.matterhorn;
matterhorn =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.matterhorn;

maxflow = callPackage ../development/libraries/maxflow { };

Expand Down Expand Up @@ -31475,7 +31491,10 @@ with pkgs;
hledger-iadd = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-iadd;
hledger-interest = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-interest;
hledger-ui = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-ui;
hledger-web = haskell.lib.compose.justStaticExecutables haskellPackages.hledger-web;
hledger-web =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.hledger-web;
hledger-utils = with python3.pkgs; toPythonApplication hledger-utils;

hmm = callPackage ../applications/misc/hmm { };
Expand Down Expand Up @@ -36150,7 +36169,10 @@ with pkgs;

bean-add = callPackage ../applications/office/beancount/bean-add.nix { };

bench = haskell.lib.compose.justStaticExecutables haskellPackages.bench;
bench =
# TODO: Erroneous references to GHC on aarch64-darwin: https://github.com/NixOS/nixpkgs/issues/318013
(if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then lib.id else haskell.lib.compose.justStaticExecutables)
haskellPackages.bench;

cri-o = callPackage ../applications/virtualization/cri-o/wrapper.nix { };
cri-o-unwrapped = callPackage ../applications/virtualization/cri-o { };
Expand Down

0 comments on commit d785f11

Please sign in to comment.