Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 318 lines 9.4 kB view raw
1{ 2 stdenv, 3 pkgs, 4 lib, 5 chickenEggs, 6}: 7let 8 inherit (lib) addMetaAttrs; 9 addToNativeBuildInputs = pkg: old: { 10 nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ lib.toList pkg; 11 }; 12 addToBuildInputs = pkg: old: { 13 buildInputs = (old.buildInputs or [ ]) ++ lib.toList pkg; 14 }; 15 addToPropagatedBuildInputs = pkg: old: { 16 propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ lib.toList pkg; 17 }; 18 addPkgConfig = old: { 19 nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ]; 20 }; 21 addToBuildInputsWithPkgConfig = pkg: old: (addPkgConfig old) // (addToBuildInputs pkg old); 22 addToPropagatedBuildInputsWithPkgConfig = 23 pkg: old: (addPkgConfig old) // (addToPropagatedBuildInputs pkg old); 24 broken = addMetaAttrs { broken = true; }; 25 brokenOnDarwin = addMetaAttrs { broken = stdenv.hostPlatform.isDarwin; }; 26 addToCscOptions = opt: old: { 27 CSC_OPTIONS = lib.concatStringsSep " " ([ old.CSC_OPTIONS or "" ] ++ lib.toList opt); 28 }; 29in 30{ 31 allegro = 32 old: 33 ( 34 (addToBuildInputsWithPkgConfig ( 35 [ 36 pkgs.allegro5 37 pkgs.libglvnd 38 pkgs.libGLU 39 ] 40 ++ lib.optionals stdenv.hostPlatform.isLinux [ pkgs.xorg.libX11 ] 41 )) 42 old 43 ) 44 // { 45 # depends on 'chicken' egg, which doesn't exist, 46 # so we specify all the deps here 47 propagatedBuildInputs = [ 48 chickenEggs.foreigners 49 ]; 50 }; 51 breadline = addToBuildInputs pkgs.readline; 52 blas = addToBuildInputsWithPkgConfig pkgs.blas; 53 blosc = addToBuildInputs pkgs.c-blosc; 54 botan = addToBuildInputsWithPkgConfig pkgs.botan2; 55 cairo = 56 old: 57 (addToBuildInputsWithPkgConfig pkgs.cairo old) 58 // (addToPropagatedBuildInputs (with chickenEggs; [ 59 srfi-1 60 srfi-13 61 ]) old); 62 cmark = addToBuildInputs pkgs.cmark; 63 comparse = old: { 64 # For some reason lazy-seq 2 gets interpreted as lazy-seq 0.0.0?? 65 postPatch = '' 66 substituteInPlace comparse.egg \ 67 --replace-fail 'lazy-seq "0.1.0"' 'lazy-seq "0.0.0"' 68 ''; 69 }; 70 epoxy = 71 old: 72 (addToPropagatedBuildInputsWithPkgConfig pkgs.libepoxy old) 73 // { 74 env.NIX_CFLAGS_COMPILE = toString [ 75 ( 76 if stdenv.cc.isClang then 77 "-Wno-error=incompatible-function-pointer-types" 78 else 79 "-Wno-error=incompatible-pointer-types" 80 ) 81 "-Wno-error=int-conversion" 82 ]; 83 }; 84 espeak = addToBuildInputsWithPkgConfig pkgs.espeak-ng; 85 exif = addToBuildInputsWithPkgConfig pkgs.libexif; 86 expat = 87 old: 88 (addToBuildInputsWithPkgConfig pkgs.expat old) 89 // { 90 env.NIX_CFLAGS_COMPILE = toString [ 91 ( 92 if stdenv.cc.isClang then 93 "-Wno-error=incompatible-function-pointer-types" 94 else 95 "-Wno-error=incompatible-pointer-types" 96 ) 97 ]; 98 }; 99 ezxdisp = 100 old: 101 (addToBuildInputsWithPkgConfig pkgs.xorg.libX11 old) 102 // { 103 env.NIX_CFLAGS_COMPILE = toString [ 104 "-Wno-error=implicit-function-declaration" 105 ]; 106 }; 107 freetype = addToBuildInputsWithPkgConfig pkgs.freetype; 108 fuse = addToBuildInputsWithPkgConfig pkgs.fuse; 109 gl-math = old: { 110 env.NIX_CFLAGS_COMPILE = toString [ 111 "-Wno-error=incompatible-pointer-types" 112 ]; 113 }; 114 gl-utils = addPkgConfig; 115 glfw3 = addToBuildInputsWithPkgConfig pkgs.glfw3; 116 glls = addPkgConfig; 117 iconv = addToBuildInputs (lib.optional stdenv.hostPlatform.isDarwin pkgs.libiconv); 118 icu = addToBuildInputsWithPkgConfig pkgs.icu; 119 imlib2 = addToBuildInputsWithPkgConfig pkgs.imlib2; 120 inotify = 121 old: 122 (addToBuildInputs (lib.optional stdenv.hostPlatform.isDarwin pkgs.libinotify-kqueue) old) 123 // lib.optionalAttrs stdenv.hostPlatform.isDarwin (addToCscOptions "-L -linotify" old); 124 leveldb = addToBuildInputs pkgs.leveldb; 125 lowdown = old: { 126 # For some reason comparse version gets interpreted as 0.0.0 127 postPatch = '' 128 substituteInPlace lowdown.egg \ 129 --replace-fail 'comparse "3"' 'comparse "0.0.0"' 130 ''; 131 }; 132 magic = addToBuildInputs pkgs.file; 133 mdh = 134 old: 135 (addToBuildInputs pkgs.pcre old) 136 // { 137 env.NIX_CFLAGS_COMPILE = toString [ 138 "-Wno-error=implicit-function-declaration" 139 "-Wno-error=implicit-int" 140 ]; 141 }; 142 medea = old: { 143 # For some reason comparse gets interpreted as comparse 0.0.0 144 postPatch = '' 145 substituteInPlace medea.egg \ 146 --replace-fail 'comparse "0.3.0"' 'comparse "0.0.0"' 147 ''; 148 }; 149 # missing dependency in upstream egg 150 mistie = addToPropagatedBuildInputs (with chickenEggs; [ srfi-1 ]); 151 mosquitto = addToPropagatedBuildInputs ([ pkgs.mosquitto ]); 152 nanomsg = addToBuildInputs pkgs.nanomsg; 153 ncurses = addToBuildInputsWithPkgConfig [ pkgs.ncurses ]; 154 opencl = addToBuildInputs ([ 155 pkgs.opencl-headers 156 pkgs.ocl-icd 157 ]); 158 openssl = addToBuildInputs pkgs.openssl; 159 plot = addToBuildInputs pkgs.plotutils; 160 postgresql = addToBuildInputsWithPkgConfig pkgs.libpq; 161 rocksdb = addToBuildInputs pkgs.rocksdb_8_3; 162 scheme2c-compatibility = addPkgConfig; 163 sdl-base = 164 old: 165 ( 166 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL old) 167 // 168 # needed for sdl-config to be in PATH 169 (addToNativeBuildInputs pkgs.SDL old) 170 ); 171 sdl2 = 172 old: 173 ( 174 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL2 old) 175 // 176 # needed for sdl2-config to be in PATH 177 (addToNativeBuildInputs pkgs.SDL2 old) 178 ); 179 sdl2-image = 180 old: 181 ( 182 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL2_image old) 183 // 184 # needed for sdl2-config to be in PATH 185 (addToNativeBuildInputs pkgs.SDL2 old) 186 ); 187 sdl2-ttf = 188 old: 189 ( 190 (addToPropagatedBuildInputsWithPkgConfig pkgs.SDL2_ttf old) 191 // 192 # needed for sdl2-config to be in PATH 193 (addToNativeBuildInputs pkgs.SDL2 old) 194 ); 195 soil = addToPropagatedBuildInputsWithPkgConfig pkgs.libepoxy; 196 sqlite3 = addToBuildInputs pkgs.sqlite; 197 stemmer = old: (addToBuildInputs pkgs.libstemmer old) // (addToCscOptions "-L -lstemmer" old); 198 stfl = 199 old: (addToBuildInputs [ pkgs.ncurses pkgs.stfl ] old) // (addToCscOptions "-L -lncurses" old); 200 taglib = 201 old: 202 (addToBuildInputs [ pkgs.zlib pkgs.taglib_1 ] old) 203 // ( 204 # needed for tablib-config to be in PATH 205 addToNativeBuildInputs pkgs.taglib_1 old 206 ); 207 uuid-lib = addToBuildInputs pkgs.libuuid; 208 webview = addToBuildInputsWithPkgConfig pkgs.webkitgtk_4_0; 209 ws-client = addToBuildInputs pkgs.zlib; 210 xlib = addToPropagatedBuildInputs pkgs.xorg.libX11; 211 yaml = addToBuildInputs pkgs.libyaml; 212 zlib = addToBuildInputs pkgs.zlib; 213 zmq = addToBuildInputs pkgs.zeromq; 214 zstd = addToBuildInputs pkgs.zstd; 215 216 # less trivial fixes, should be upstreamed 217 git = 218 old: 219 (addToBuildInputsWithPkgConfig pkgs.libgit2 old) 220 // { 221 postPatch = '' 222 substituteInPlace libgit2.scm \ 223 --replace "asize" "reserved" 224 ''; 225 }; 226 lazy-ffi = 227 old: 228 (addToBuildInputs pkgs.libffi old) 229 // { 230 postPatch = '' 231 substituteInPlace lazy-ffi.scm \ 232 --replace "ffi/ffi.h" "ffi.h" 233 ''; 234 }; 235 opengl = 236 old: 237 (addToBuildInputsWithPkgConfig (lib.optionals (!stdenv.hostPlatform.isDarwin) [ 238 pkgs.libGL 239 pkgs.libGLU 240 ]) old) 241 // { 242 postPatch = '' 243 substituteInPlace opengl.egg \ 244 --replace 'framework ' 'framework" "' 245 ''; 246 }; 247 posix-shm = old: { 248 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' 249 substituteInPlace build.scm \ 250 --replace "-lrt" "" 251 ''; 252 }; 253 254 # platform changes 255 pledge = addMetaAttrs { platforms = lib.platforms.openbsd; }; 256 unveil = addMetaAttrs { platforms = lib.platforms.openbsd; }; 257 258 # overrides for chicken 5.4 259 dbus = 260 old: 261 (addToBuildInputsWithPkgConfig [ pkgs.dbus ] old) 262 // { 263 # backticks in compiler options 264 # aren't supported anymore as of chicken 5.4, it seems. 265 preBuild = '' 266 substituteInPlace \ 267 dbus.egg dbus.setup \ 268 --replace '`pkg-config --cflags dbus-1`' "$(pkg-config --cflags dbus-1)" \ 269 --replace '`pkg-config --libs dbus-1`' "$(pkg-config --libs dbus-1)" 270 ''; 271 }; 272 math = old: { 273 # define-values is used but not imported 274 # some breaking change happened now it needs to be done 275 # explicitly? 276 preBuild = '' 277 substituteInPlace *.scm **/*.scm \ 278 --replace-quiet 'only chicken.base' 'only chicken.base define-values' 279 ''; 280 }; 281 socket = old: { 282 # chicken-do checks for changes to a file that doesn't exist 283 preBuild = '' 284 touch socket-config 285 ''; 286 }; 287 288 # mark broken 289 "ephem-v1.1" = broken; 290 F-operator = broken; 291 atom = broken; 292 begin-syntax = broken; 293 canvas-draw = broken; 294 chicken-doc-admin = broken; 295 coops-utils = broken; 296 crypt = broken; 297 hypergiant = broken; 298 iup = broken; 299 kiwi = broken; 300 lmdb-ht = broken; 301 mpi = broken; 302 pyffi = broken; 303 qt-light = broken; 304 salmonella-html-report = broken; 305 sundials = broken; 306 svn-client = broken; 307 system = broken; 308 tokyocabinet = broken; 309 310 # mark broken darwin 311 312 # fatal error: 'mqueue.h' file not found 313 posix-mq = brokenOnDarwin; 314 # Undefined symbols for architecture arm64: "_pthread_setschedprio" 315 pthreads = brokenOnDarwin; 316 # error: use of undeclared identifier 'B4000000' 317 stty = brokenOnDarwin; 318}