nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 nasm,
8 alsa-lib,
9 ffmpeg_7,
10 glew,
11 glib,
12 gtk3,
13 libmad,
14 libogg,
15 libpng,
16 libpulseaudio,
17 libvorbis,
18 udev,
19 libxtst,
20 zlib,
21}:
22
23stdenv.mkDerivation {
24 pname = "stepmania";
25 version = "5.1.0-b2-unstable-2022-11-14";
26
27 src = fetchFromGitHub {
28 owner = "stepmania";
29 repo = "stepmania";
30 rev = "d55acb1ba26f1c5b5e3048d6d6c0bd116625216f";
31 hash = "sha256-49H2Q61R4l/G0fWsjCjiAUXeWwG3lcsDpV5XvR3l3QE=";
32 };
33
34 patches = [
35 (fetchpatch {
36 # Fix building with newer FFmpeg
37 name = "fix-building-with-newer-ffmpeg.patch";
38 url = "https://github.com/stepmania/stepmania/commit/3fef5ef60b7674d6431f4e1e4ba8c69b0c21c023.patch?full_index=1";
39 hash = "sha256-m+5sP+mIpcSjioRBdzChqja5zwNcwdSNAfvSJ2Lww+g=";
40 })
41 (fetchpatch {
42 # Fix crash on loading animated previews while using newer FFmpeg
43 name = "fix-crash-newer-ffmpeg.patch";
44 url = "https://github.com/stepmania/stepmania/commit/e0d2a5182dcd855e181fffa086273460c553c7ff.patch?full_index=1";
45 hash = "sha256-XacaMn29FwG3WgFBfB890I8mzVrvuOL4wPWcHHNYfXM=";
46 })
47 # FFmpeg 7 frame_number compatibility fix
48 ./ffmpeg-7.patch
49 ];
50
51 postPatch = ''
52 sed '1i#include <ctime>' -i src/arch/ArchHooks/ArchHooks.h # gcc12
53
54 substituteInPlace CMakeLists.txt \
55 --replace-fail 'cmake_minimum_required(VERSION 2.8.12)' 'cmake_minimum_required(VERSION 3.10)'
56 '';
57
58 nativeBuildInputs = [
59 cmake
60 nasm
61 ];
62
63 buildInputs = [
64 alsa-lib
65 ffmpeg_7
66 glew
67 glib
68 gtk3
69 libmad
70 libogg
71 libpng
72 libpulseaudio
73 libvorbis
74 udev
75 libxtst
76 zlib
77 ];
78
79 cmakeFlags = [
80 "-DWITH_SYSTEM_FFMPEG=1"
81 "-DWITH_SYSTEM_PNG=on"
82 "-DWITH_SYSTEM_ZLIB=on"
83 ];
84
85 postInstall = ''
86 mkdir -p $out/bin
87 ln -s $out/stepmania-5.1/stepmania $out/bin/stepmania
88
89 mkdir -p $out/share/
90 cp -r $src/icons $out/share/
91
92 install -Dm444 $src/stepmania.desktop -t $out/share/applications
93 '';
94
95 meta = {
96 homepage = "https://www.stepmania.com/";
97 description = "Free dance and rhythm game for Windows, Mac, and Linux";
98 platforms = lib.platforms.linux;
99 license = lib.licenses.mit; # expat version
100 maintainers = with lib.maintainers; [ h7x4 ];
101 mainProgram = "stepmania";
102 };
103}