From d785f1185eb41a659cd04ab971959eb853562371 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sat, 8 Jun 2024 10:29:32 +0200 Subject: [PATCH] treewide: no justStaticExecutables on aarch64-darwin for bogus refs 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 --- .../continuous-integration/hci/default.nix | 5 ++- .../hercules-ci-agent/default.nix | 5 ++- pkgs/top-level/all-packages.nix | 36 +++++++++++++++---- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/hci/default.nix b/pkgs/development/tools/continuous-integration/hci/default.nix index 0fac1dfc04c6..4f04e0494f0f 100644 --- a/pkgs/development/tools/continuous-integration/hci/default.nix +++ b/pkgs/development/tools/continuous-integration/hci/default.nix @@ -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"; diff --git a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix index 8d4805341d55..3a1cbecd282d 100644 --- a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix +++ b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix @@ -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"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index abd9530402e5..20e4cd0b488d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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; @@ -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 { }; @@ -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 { }; @@ -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 { }; @@ -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 { }; @@ -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 { }; @@ -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 { }; @@ -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 { };