Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, lib, fetchurl, fetchFromGitHub, pkg-config, libGLU, libGL 2, SDL2, libpng, libvorbis, libogg, libmikmod 3 4, use3DOVideos ? false, requireFile ? null, writeText ? null 5, haskellPackages ? null 6 7, useRemixPacks ? false 8}: 9 10assert use3DOVideos -> requireFile != null && writeText != null 11 && haskellPackages != null; 12 13let 14 videos = import ./3dovideo.nix { 15 inherit stdenv lib requireFile writeText fetchFromGitHub haskellPackages; 16 }; 17 18 remixPacks = lib.imap1 (num: sha256: fetchurl rec { 19 name = "uqm-remix-disc${toString num}.uqm"; 20 url = "mirror://sourceforge/sc2/${name}"; 21 inherit sha256; 22 }) [ 23 "1s470i6hm53l214f2rkrbp111q4jyvnxbzdziqg32ffr8m3nk5xn" 24 "1pmsq65k8gk4jcbyk3qjgi9yqlm0dlaimc2r8hz2fc9f2124gfvz" 25 "07g966ylvw9k5q9jdzqdczp7c5qv4s91xjlg4z5z27fgcs7rzn76" 26 "1l46k9aqlcp7d3fjkjb3n05cjfkxx8rjlypgqy0jmdx529vikj54" 27 ]; 28 29in stdenv.mkDerivation rec { 30 pname = "uqm"; 31 version = "0.8.0"; 32 33 src = fetchurl { 34 url = "mirror://sourceforge/sc2/uqm-${version}-src.tgz"; 35 sha256 = "JPL325z3+vU7lfniWA5vWWIFqY7QwzXP6DTGR4WtT1o="; 36 }; 37 38 content = fetchurl { 39 url = "mirror://sourceforge/sc2/uqm-${version}-content.uqm"; 40 sha256 = "d9dawl5vt1WjPEujs4p7e8Qfy8AolokbDMmskhS3Lu8="; 41 }; 42 43 voice = fetchurl { 44 url = "mirror://sourceforge/sc2/uqm-${version}-voice.uqm"; 45 sha256 = "ntv1HXfYtTM5nF86+1STFKghDXqrccosUbTySDIzekU="; 46 }; 47 48 music = fetchurl { 49 url = "mirror://sourceforge/sc2/uqm-${version}-3domusic.uqm"; 50 sha256 = "RM087H6VabQRettNd/FSKJCXJWYmc5GuCWMUhdIx2Lk="; 51 }; 52 53 nativeBuildInputs = [ pkg-config ]; 54 buildInputs = [ SDL2 libpng libvorbis libogg libmikmod libGLU libGL ]; 55 56 postUnpack = '' 57 mkdir -p uqm-${version}/content/packages 58 mkdir -p uqm-${version}/content/addons 59 ln -s "$content" "uqm-${version}/content/packages/uqm-${version}-content.uqm" 60 ln -s "$music" "uqm-${version}/content/addons/uqm-${version}-3domusic.uqm" 61 ln -s "$voice" "uqm-${version}/content/addons/uqm-${version}-voice.uqm" 62 '' + lib.optionalString useRemixPacks (lib.concatMapStrings (disc: '' 63 ln -s "${disc}" "uqm-$version/content/addons/${disc.name}" 64 '') remixPacks) + lib.optionalString use3DOVideos '' 65 ln -s "${videos}" "uqm-${version}/content/addons/3dovideo" 66 ''; 67 68 postPatch = '' 69 # Using _STRINGS_H as include guard conflicts with glibc. 70 sed -i -e '/^#/s/_STRINGS_H/_UQM_STRINGS_H/g' src/uqm/comm/*/strings.h 71 # See https://github.com/NixOS/nixpkgs/pull/93560 72 sed -i -e 's,/tmp/,$TMPDIR/,' build/unix/config_functions 73 ''; 74 75 # uqm has a 'unique' build system with a root script incidentally called 76 # 'build.sh'. 77 configurePhase = '' 78 echo "INPUT_install_prefix_VALUE='$out'" >> config.state 79 echo "INPUT_install_bindir_VALUE='$out/bin'" >> config.state 80 echo "INPUT_install_libdir_VALUE='$out/lib'" >> config.state 81 echo "INPUT_install_sharedir_VALUE='$out/share'" >> config.state 82 PREFIX=$out ./build.sh uqm config 83 ''; 84 85 buildPhase = '' 86 ./build.sh uqm 87 ''; 88 89 installPhase = '' 90 ./build.sh uqm install 91 sed -i $out/bin/uqm -e "s%/usr/local/games/%$out%g" 92 ''; 93 94 meta = { 95 description = "Remake of Star Control II"; 96 longDescription = '' 97 The goals for the The Ur-Quan Masters project are: 98 - to bring Star Control II to modern platforms, thereby making a lot of 99 people happy 100 - to make game translations easy, thereby making even more people happy 101 - to adapt the code so that people can more easily make their own 102 spin-offs, thereby making zillions more people happy! 103 ''; 104 homepage = "https://sc2.sourceforge.net/"; 105 license = lib.licenses.gpl2; 106 maintainers = with lib.maintainers; [ jcumming aszlig ]; 107 platforms = with lib.platforms; linux; 108 }; 109}