|
56 | 56 | cddl = final.callPackage ./pkgs/cddl { }; |
57 | 57 | }); |
58 | 58 |
|
| 59 | + # Fixes for static (musl) builds. pkgsStatic sets isStatic=true, |
| 60 | + # so most optional features (jit, perl, python, tcl) already |
| 61 | + # default to false. Only cross-compilation quirks remain. |
59 | 62 | musl = (final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isMusl { |
60 | | - # We don't need a ruby static build. We're only interested in producing static |
61 | | - # outputs, not necessarily build tools. |
| 63 | + # Use build-platform ruby instead of building a static one. |
62 | 64 | ruby = prev.pkgsBuildBuild.ruby; |
63 | 65 |
|
64 | | - # OpenSSL 3.6.0 test 82-test_ocsp_cert_chain.t fails in the nix sandbox |
65 | | - # because the OCSP stapling test requires network/timing conditions that |
66 | | - # aren't reliably available during cross-compilation builds. Only 1 of 3888 |
67 | | - # tests fails, and it's unrelated to the actual crypto functionality. |
| 66 | + # OpenSSL OCSP stapling test is flaky in the nix sandbox. |
68 | 67 | openssl = prev.openssl.overrideAttrs (old: { |
69 | 68 | preCheck = (old.preCheck or "") + '' |
70 | 69 | rm -f test/recipes/82-test_ocsp_cert_chain.t |
71 | 70 | ''; |
72 | 71 | }); |
73 | 72 |
|
74 | | - # PostgreSQL fixes for musl cross-compilation: |
75 | | - # |
76 | | - # nixpkgs-2511 postgresql/generic.nix has multiple issues with |
77 | | - # musl64 because pkgsCross.musl64 doesn't set isStatic=true: |
78 | | - # |
79 | | - # 1. jitSupport defaults true → pulls in LLVM build inputs. |
80 | | - # 2. perlSupport defaults true → musl perl lacks shared libperl. |
81 | | - # 3. pythonSupport/tclSupport default true → adds plpython3/pltcl |
82 | | - # outputs. These are unnecessary for musl cross-builds and |
83 | | - # each extra output widens the nix-copy window, exacerbating |
84 | | - # the min-free GC race on darwin builders. |
85 | | - # 4. generic.nix switches to LLVM stdenv+bintools for LTO when |
86 | | - # GCC is used. Cross-compiled LLVM 20 OOMs on darwin builders. |
87 | | - # We override llvmPackages_20 to prevent the switch (avoids |
88 | | - # LLVM dependency), then explicitly disable LTO with -fno-lto |
89 | | - # since GCC LTO + GNU ld is broken for postgresql (.ltrans |
90 | | - # link failures). Can't use hardeningDisable=["lto"] because |
91 | | - # "lto" is not a recognized hardening flag on musl cross. |
92 | | - # 5. outputChecks unconditionally reference llvmPackages.llvm. |
| 73 | + # PostgreSQL cross-compilation fixes: |
| 74 | + # - generic.nix switches to LLVM stdenv for LTO when GCC is |
| 75 | + # used. Cross-compiled LLVM 20 OOMs on darwin builders. |
| 76 | + # Override llvmPackages_20 to prevent the switch. |
| 77 | + # - GCC LTO + GNU ld produces .ltrans link failures; disable. |
| 78 | + # - outputChecks unconditionally reference llvmPackages.llvm. |
| 79 | + # - disallowedReferences fails for cross (cc refs in .pc/.la). |
| 80 | + # - Multi-output reference cycles (dev↔out, lib↔out) must be |
| 81 | + # broken or Nix refuses to register the outputs. |
93 | 82 | postgresql = (prev.postgresql.override { |
94 | | - jitSupport = false; |
95 | | - perlSupport = false; |
96 | | - pythonSupport = false; |
97 | | - tclSupport = false; |
98 | | - # Prevent the LTO stdenv switch: provide normal GCC-based |
99 | | - # musl stdenv as llvmPackages_20, making the switch a no-op. |
100 | 83 | llvmPackages_20 = prev.llvmPackages_20 // { |
101 | 84 | inherit (prev) stdenv; |
102 | 85 | bintools = prev.stdenv.cc.bintools; |
103 | 86 | }; |
104 | 87 | }).overrideAttrs (old: { |
105 | | - # Explicitly disable LTO since we're using GCC + GNU ld |
106 | | - # (not the LLVM bintools the stdenv switch would provide). |
107 | 88 | env = (old.env or {}) // { |
108 | 89 | NIX_CFLAGS_COMPILE = (old.env.NIX_CFLAGS_COMPILE or "") + " -fno-lto"; |
109 | 90 | }; |
110 | 91 | doCheck = false; |
111 | 92 | outputChecks = {}; |
112 | 93 | separateDebugInfo = false; |
113 | 94 | disallowedReferences = []; |
114 | | - # Break multi-output reference cycles. Nix refuses to register |
115 | | - # outputs that form cycles. The cycles are: |
116 | | - # dev ↔ out: dev has .pc files referencing out; out has |
117 | | - # baked-in dev paths from configure |
118 | | - # lib ↔ out: lib has embedded out paths (share/locale refs |
119 | | - # in libpq); out links against lib |
120 | | - # Fix: strip dev refs from out+lib, strip out refs from lib. |
121 | | - # out→lib is the only legitimate runtime dependency. |
122 | 95 | postFixup = (old.postFixup or "") + '' |
123 | 96 | find "$out" -name '*.la' -delete |
124 | 97 | find "$out" -type f -exec remove-references-to -t "$dev" {} + |
|
150 | 123 | # nix develop github:input-output-hk/devx#ghc96 --no-write-lock-file -c cabal build |
151 | 124 | # |
152 | 125 | static-pkgs = if pkgs.stdenv.hostPlatform.isLinux |
153 | | - then if pkgs.stdenv.hostPlatform.isAarch64 |
154 | | - then pkgs.pkgsCross.aarch64-multiplatform-musl |
155 | | - else pkgs.pkgsCross.musl64 |
| 126 | + then pkgs.pkgsStatic |
156 | 127 | else pkgs; |
157 | 128 | js-pkgs = pkgs.pkgsCross.ghcjs; |
158 | 129 | windows-pkgs = pkgs.pkgsCross.mingwW64; |
|
0 commit comments