postgresql: reorganize musl patches (#260067)

This also adds support for building postgresql 15 and 16 under musl.

authored by Yureka and committed by GitHub 8a0223ec bfc5d57d

+44 -17
+44 -17
pkgs/servers/sql/postgresql/default.nix
··· 110 locale = "${if stdenv.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc}/bin/locale"; 111 }) 112 113 - ] ++ lib.optionals (stdenv'.hostPlatform.isMusl && atLeast "12") [ 114 - (fetchpatch { 115 - url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/icu-collations-hack.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7"; 116 - hash = "sha256-Yb6lMBDqeVP/BLMyIr5rmR6OkaVzo68cV/+cL2LOe/M="; 117 - }) 118 - ] ++ lib.optionals (stdenv'.hostPlatform.isMusl && atLeast "13") [ 119 - (if olderThan "14" then 120 - fetchpatch { 121 - url = "https://git.alpinelinux.org/aports/plain/main/postgresql13/disable-test-collate.icu.utf8.patch?id=69faa146ec9fff3b981511068f17f9e629d4688b"; 122 - hash = "sha256-IOOx7/laDYhTz1Q1r6H1FSZBsHCgD4lHvia+/os7CCo="; 123 - } 124 - else 125 - fetchpatch { 126 - url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/disable-test-collate.icu.utf8.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7"; 127 - hash = "sha256-pnl+wM3/IUyq5iJzk+h278MDA9R0GQXQX8d4wJcB2z4="; 128 - }) 129 - ] ++ lib.optionals stdenv'.isLinux [ 130 (if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch) 131 ]; 132
··· 110 locale = "${if stdenv.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc}/bin/locale"; 111 }) 112 113 + ] ++ lib.optionals stdenv'.hostPlatform.isMusl ( 114 + let 115 + self = { 116 + "12" = { 117 + icu-collations-hack = fetchurl { 118 + url = "https://git.alpinelinux.org/aports/plain/testing/postgresql12/icu-collations-hack.patch?id=d5227c91adda59d4e7f55f13468f0314e8869174"; 119 + hash = "sha256-wuwjvGHArkRNwFo40g3p43W32OrJohretlt6iSRlJKg="; 120 + }; 121 + }; 122 + "13" = { 123 + inherit (self."14") icu-collations-hack; 124 + disable-test-collate-icu-utf8 = fetchurl { 125 + url = "https://git.alpinelinux.org/aports/plain/main/postgresql13/disable-test-collate.icu.utf8.patch?id=69faa146ec9fff3b981511068f17f9e629d4688b"; 126 + hash = "sha256-jS/qxezaiaKhkWeMCXwpz1SDJwUWn9tzN0uKaZ3Ph2Y="; 127 + }; 128 + }; 129 + "14" = { 130 + icu-collations-hack = fetchurl { 131 + url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/icu-collations-hack.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7"; 132 + hash = "sha256-wuwjvGHArkRNwFo40g3p43W32OrJohretlt6iSRlJKg="; 133 + }; 134 + disable-test-collate-icu-utf8 = fetchurl { 135 + url = "https://git.alpinelinux.org/aports/plain/main/postgresql14/disable-test-collate.icu.utf8.patch?id=56999e6d0265ceff5c5239f85fdd33e146f06cb7"; 136 + hash = "sha256-jXe23AxnFjEl+TZQm4R7rStk2Leo08ctxMNmu1xr5zM="; 137 + }; 138 + }; 139 + "15" = { 140 + icu-collations-hack = fetchurl { 141 + url = "https://git.alpinelinux.org/aports/plain/main/postgresql15/icu-collations-hack.patch?id=f424e934e6d076c4ae065ce45e734aa283eecb9c"; 142 + hash = "sha256-HgtmhF4OJYU9macGJbTB9PjQi/yW7c3Akm3U0niWs8I="; 143 + }; 144 + }; 145 + "16" = { 146 + icu-collations-hack = fetchurl { 147 + url = "https://git.alpinelinux.org/aports/plain/main/postgresql16/icu-collations-hack.patch?id=08a24be262339fd093e641860680944c3590238e"; 148 + hash = "sha256-+urQdVIlADLdDPeT68XYv5rljhbK8M/7mPZn/cF+FT0="; 149 + }; 150 + }; 151 + }; 152 + 153 + patchesForVersion = self.${lib.versions.major version} or (throw "no musl patches for postgresql ${version}"); 154 + in 155 + lib.attrValues patchesForVersion 156 + ) ++ lib.optionals stdenv'.isLinux [ 157 (if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch) 158 ]; 159