diff --git a/internal/devpkg/package.go b/internal/devpkg/package.go index 35e7b17a494..892569e8dc1 100644 --- a/internal/devpkg/package.go +++ b/internal/devpkg/package.go @@ -187,9 +187,7 @@ func patchGlibcFunc(canonicalName string, mode configfile.PatchMode) func() bool case configfile.PatchNever: patch = false } - - // Check nix.SystemIsLinux() last because it's slow. - return patch && nix.SystemIsLinux() + return patch }) } diff --git a/internal/patchpkg/builder.go b/internal/patchpkg/builder.go index a42522579ce..5be3f771bd3 100644 --- a/internal/patchpkg/builder.go +++ b/internal/patchpkg/builder.go @@ -232,7 +232,7 @@ func (d *DerivationBuilder) needsGlibcPatch(file *bufio.Reader, filePath string) func (d *DerivationBuilder) findRemovedRefs(ctx context.Context, pkg *packageFS) ([]fileSlice, error) { var refs []fileSlice - matches, err := fs.Glob(pkg, "lib/python*/_sysconfigdata__linux*.py") + matches, err := fs.Glob(pkg, "lib/python*/_sysconfigdata_*.py") if err != nil { return nil, err } diff --git a/internal/shellgen/tmpl/glibc-patch.nix.tmpl b/internal/shellgen/tmpl/glibc-patch.nix.tmpl index d07d1b042c3..ea90a044710 100644 --- a/internal/shellgen/tmpl/glibc-patch.nix.tmpl +++ b/internal/shellgen/tmpl/glibc-patch.nix.tmpl @@ -73,7 +73,10 @@ builtins.map (drv: drv.outPath) mkTree; # Programs needed by glibc-patch.bash. - inherit (nixpkgs-glibc.legacyPackages."${system}") bash coreutils glibc gnused patchelf ripgrep; + inherit (nixpkgs-glibc.legacyPackages."${system}") bash coreutils gnused patchelf ripgrep; + + isLinux = (builtins.match ".*linux.*" system) != null; + glibc = if isLinux then nixpkgs-glibc.legacyPackages."${system}".glibc else null; # Create a package that puts the local devbox binary in the conventional # bin subdirectory. This also ensures that the executable is named @@ -92,7 +95,9 @@ DEVBOX_DEBUG = 1; builder = "${devbox}/bin/devbox"; - args = [ "patch" "--restore-refs" "--glibc" glibc pkg ]; + args = [ "patch" "--restore-refs" ] ++ + (if glibc != null then [ "--glibc" "${glibc}" ] else [ ]) ++ + [ pkg ]; }; in {