patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: colbyt <colby@colbyt.com>
To: devel@spectrum-os.org
Cc: colbyt <colby@colbyt.com>
Subject: [PATCH 1/8] pkgs: fix aarch64-musl builds with current nixpkgs
Date: Fri, 26 Jun 2026 11:55:01 -0700	[thread overview]
Message-ID: <20260626185509.3715326-2-colby@colbyt.com> (raw)
In-Reply-To: <20260626185509.3715326-1-colby@colbyt.com>

The newer nixpkgs pin exposes several aarch64-musl build issues in
Spectrum dependencies.

Normalize Python bootstrap outputs that install under usr/, patch the
generated pyproject-build wrapper to include those paths, and keep the
GnuTLS STARTTLS tests from observing a host /usr/bin/socat that is not
on PATH.

Also skip the exact psutil and mypy tests that depend on host network or
unsandboxed root directory details. The remaining package test suites
pass with those exact deselections.

Signed-off-by: colbyt <colby@colbyt.com>
---
 pkgs/overlay.nix | 105 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)

diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix
index 3e3336e..66fea11 100644
--- a/pkgs/overlay.nix
+++ b/pkgs/overlay.nix
@@ -4,12 +4,117 @@
 (final: super: {
   cloud-hypervisor = import ./cloud-hypervisor { inherit final super; };
 
+  coreutils = super.coreutils.overrideAttrs ({ postPatch ? "", ... }: (
+    final.lib.optionalAttrs
+      (super.stdenv.hostPlatform.isAarch64 && super.stdenv.hostPlatform.isMusl)
+      {
+        postPatch = postPatch + ''
+          # These locale-sensitive tests fail in the aarch64-musl bootstrap build.
+          for f in \
+            tests/cut/mb-non-utf8.sh \
+            tests/date/date-locale-hour.sh \
+            tests/dd/conv-case.sh \
+            tests/numfmt/mb-non-utf8.sh \
+            tests/paste/multi-byte.sh \
+            tests/sort/sort-h-thousands-sep.sh \
+            tests/sort/sort-month.sh
+          do
+            sed '2i echo Skipping aarch64-musl locale test && exit 77' -i "$f"
+          done
+        '';
+      }
+  ));
+
+  python313 = super.python313.override {
+    packageOverrides = _pythonFinal: pythonSuper:
+      let
+        # Some aarch64-musl bootstrap wheels install below usr/.
+        normalizeBootstrapOutput = drv:
+          drv.overrideAttrs ({ postInstall ? "", ... }: (
+            final.lib.optionalAttrs
+              (super.stdenv.hostPlatform.isAarch64 && super.stdenv.hostPlatform.isMusl)
+              {
+                postInstall = postInstall + ''
+                  if [ -d "$out/usr" ]; then
+                    cp -a "$out"/usr/. "$out"/
+                    rm -rf "$out/usr"
+                  fi
+                '';
+              }
+          ));
+      in
+      {
+        bootstrap = pythonSuper.bootstrap // {
+          build = pythonSuper.bootstrap.build.overrideAttrs ({ installPhase ? "", ... }: (
+            final.lib.optionalAttrs
+              (super.stdenv.hostPlatform.isAarch64 && super.stdenv.hostPlatform.isMusl)
+              {
+                installPhase = builtins.replaceStrings
+                  [ "\nwrapProgram $out/bin/pyproject-build" ]
+                  [ ''
+
+                  if [ -d "$out/usr" ]; then
+                    cp -a "$out"/usr/. "$out"/
+                    rm -rf "$out/usr"
+                  fi
+                  chmod +x "$out/bin/pyproject-build"
+                  wrapProgram $out/bin/pyproject-build'' ]
+                  installPhase + ''
+
+                    sed -E -i \
+                      's#(/nix/store/[^:"]+-python3[.]13-bootstrap-(packaging|pyproject-hooks|tomli)-[^/:"]*)/lib/python3[.]13/site-packages#\1/lib/python3.13/site-packages:\1/usr/lib/python3.13/site-packages#g' \
+                      "$out/bin/pyproject-build"
+                  '';
+              }
+          ));
+
+          installer = normalizeBootstrapOutput pythonSuper.bootstrap.installer;
+          packaging = normalizeBootstrapOutput pythonSuper.bootstrap.packaging;
+        };
+
+        psutil = pythonSuper.psutil.overrideAttrs ({ disabledTestPaths ? [], ... }: (
+          final.lib.optionalAttrs
+            (super.stdenv.hostPlatform.isAarch64 && super.stdenv.hostPlatform.isMusl)
+            {
+              disabledTestPaths = disabledTestPaths ++ [
+                # The test depends on host interface broadcast semantics.
+                "tests/test_system.py::TestNetAPIs::test_net_if_addrs"
+              ];
+            }
+        ));
+
+        mypy = pythonSuper.mypy.overrideAttrs ({ disabledTestPaths ? [], ... }: (
+          final.lib.optionalAttrs
+            (super.stdenv.hostPlatform.isAarch64 && super.stdenv.hostPlatform.isMusl)
+            {
+              disabledTestPaths = disabledTestPaths ++ [
+                # The fake root source test observes the unsandboxed build root.
+                "mypy/test/test_find_sources.py::SourceFinderSuite::test_find_sources_exclude"
+              ];
+            }
+        ));
+      };
+  };
+
   flatpak = super.flatpak.override (
     final.lib.optionalAttrs final.stdenv.hostPlatform.isMusl {
       withMalcontent = false;
     }
   );
 
+  gnutls = super.gnutls.overrideAttrs ({ postPatch ? "", ... }: (
+    final.lib.optionalAttrs
+      (super.stdenv.hostPlatform.isAarch64 && super.stdenv.hostPlatform.isMusl)
+      {
+        postPatch = postPatch + ''
+          # The test later executes socat from PATH, not /usr/bin.
+          substituteInPlace tests/scripts/starttls-common.sh \
+            --replace-fail 'if test ! -x /usr/bin/socat;then' \
+                           'if ! command -v socat >/dev/null 2>&1; then'
+        '';
+      }
+  ));
+
   gtk3 = import ./gtk3 { inherit final super; };
 
   mailutils = super.mailutils.overrideAttrs (_: (
-- 
2.54.0


  reply	other threads:[~2026-06-26 18:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26 18:55 [PATCH 0/8] refresh nixpkgs for Linux 7.1 colbyt
2026-06-26 18:55 ` colbyt [this message]
2026-07-02 12:18   ` [PATCH 1/8] pkgs: fix aarch64-musl builds with current nixpkgs Alyssa Ross
2026-06-26 18:55 ` [PATCH 2/8] lib: update nixpkgs colbyt
2026-06-26 18:55 ` [PATCH 3/8] pkgs/skaware: vendor backported patches colbyt
2026-07-02 11:53   ` Alyssa Ross
2026-06-26 18:55 ` [PATCH 4/8] pkgs/gtk3: skip integrated Wayland backport colbyt
2026-07-02 12:19   ` Alyssa Ross
2026-06-26 18:55 ` [PATCH 5/8] pkgs/skaware: skip integrated backports colbyt
2026-06-26 18:55 ` [PATCH 6/8] pkgs/cloud-hypervisor: update GPU patchset to v52 colbyt
2026-06-26 18:55 ` [PATCH 7/8] pkgs/libfyaml: fix pkg-config libs colbyt
2026-06-26 18:55 ` [PATCH 8/8] vm-lib: allow app VMs to name closure roots colbyt
2026-07-02 13:38   ` Alyssa Ross
2026-07-02 23:40     ` colby
2026-07-03 14:02       ` Alyssa Ross
2026-06-26 18:55 ` [PATCH optional] linux: use 6.18 for generic images colbyt
2026-07-02 13:42   ` Alyssa Ross
2026-07-02 23:20     ` colby
2026-07-02 12:03 ` [PATCH 0/8] refresh nixpkgs for Linux 7.1 Alyssa Ross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260626185509.3715326-2-colby@colbyt.com \
    --to=colby@colbyt.com \
    --cc=devel@spectrum-os.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).