1 { stdenv, lib, fetchurl, fetchFromGitHub, pkg-config, libGLU, libGL
2 , SDL2, libpng, libvorbis, libogg, libmikmod
4 , use3DOVideos ? false, requireFile ? null, writeText ? null
5 , haskellPackages ? null
7 , useRemixPacks ? false
10 assert use3DOVideos -> requireFile != null && writeText != null
11 && haskellPackages != null;
14 videos = import ./3dovideo.nix {
15 inherit stdenv lib requireFile writeText fetchFromGitHub haskellPackages;
18 remixPacks = lib.imap1 (num: sha256: fetchurl rec {
19 name = "uqm-remix-disc${toString num}.uqm";
20 url = "mirror://sourceforge/sc2/${name}";
23 "1s470i6hm53l214f2rkrbp111q4jyvnxbzdziqg32ffr8m3nk5xn"
24 "1pmsq65k8gk4jcbyk3qjgi9yqlm0dlaimc2r8hz2fc9f2124gfvz"
25 "07g966ylvw9k5q9jdzqdczp7c5qv4s91xjlg4z5z27fgcs7rzn76"
26 "1l46k9aqlcp7d3fjkjb3n05cjfkxx8rjlypgqy0jmdx529vikj54"
29 in stdenv.mkDerivation rec {
34 url = "mirror://sourceforge/sc2/uqm-${version}-src.tgz";
35 sha256 = "JPL325z3+vU7lfniWA5vWWIFqY7QwzXP6DTGR4WtT1o=";
39 url = "mirror://sourceforge/sc2/uqm-${version}-content.uqm";
40 sha256 = "d9dawl5vt1WjPEujs4p7e8Qfy8AolokbDMmskhS3Lu8=";
44 url = "mirror://sourceforge/sc2/uqm-${version}-voice.uqm";
45 sha256 = "ntv1HXfYtTM5nF86+1STFKghDXqrccosUbTySDIzekU=";
49 url = "mirror://sourceforge/sc2/uqm-${version}-3domusic.uqm";
50 sha256 = "RM087H6VabQRettNd/FSKJCXJWYmc5GuCWMUhdIx2Lk=";
53 nativeBuildInputs = [ pkg-config ];
54 buildInputs = [ SDL2 libpng libvorbis libogg libmikmod libGLU libGL ];
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"
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
75 # uqm has a 'unique' build system with a root script incidentally called
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
90 ./build.sh uqm install
91 sed -i $out/bin/uqm -e "s%/usr/local/games/%$out%g"
95 description = "Remake of Star Control II";
98 The goals for the The Ur-Quan Masters project are:
99 - to bring Star Control II to modern platforms, thereby making a lot of
101 - to make game translations easy, thereby making even more people happy
102 - to adapt the code so that people can more easily make their own
103 spin-offs, thereby making zillions more people happy!
105 homepage = "https://sc2.sourceforge.net/";
106 license = lib.licenses.gpl2Plus;
107 maintainers = with lib.maintainers; [ jcumming aszlig ];
108 platforms = with lib.platforms; linux;