|
| 1 | +{ |
| 2 | + lib, |
| 3 | + stdenv, |
| 4 | + fetchFromGitHub, |
| 5 | + cmake, |
| 6 | + makeWrapper, |
| 7 | + ninja, |
| 8 | + SDL2, |
| 9 | + SDL2_image, |
| 10 | + SDL2_mixer, |
| 11 | + nix-update-script, |
| 12 | +}: |
| 13 | + |
| 14 | +stdenv.mkDerivation (finalAttrs: { |
| 15 | + pname = "biplanes-revival"; |
| 16 | + version = "1.2.1"; |
| 17 | + |
| 18 | + src = fetchFromGitHub { |
| 19 | + owner = "regular-dev"; |
| 20 | + repo = "biplanes-revival"; |
| 21 | + tag = "v${finalAttrs.version}"; |
| 22 | + hash = "sha256-rdPcI4j84fVKNwv2OQ9gwC0X2CHlObYfSYkCMlcm4sM="; |
| 23 | + fetchSubmodules = true; |
| 24 | + }; |
| 25 | + |
| 26 | + nativeBuildInputs = [ |
| 27 | + cmake |
| 28 | + makeWrapper |
| 29 | + ninja |
| 30 | + ]; |
| 31 | + |
| 32 | + buildInputs = [ |
| 33 | + SDL2 |
| 34 | + SDL2_image |
| 35 | + SDL2_mixer |
| 36 | + ]; |
| 37 | + |
| 38 | + strictDeps = true; |
| 39 | + |
| 40 | + postInstall = '' |
| 41 | + id="org.regular_dev.biplanes_revival" |
| 42 | + install -Dm644 $src/flatpak-data/$id.desktop -t $out/share/applications |
| 43 | + install -Dm644 $src/flatpak-data/$id.metainfo.xml -t $out/share/metainfo |
| 44 | + install -Dm644 $src/flatpak-data/$id.svg -t $out/share/icons/hicolor/scalable/apps |
| 45 | +
|
| 46 | + # Move assets directory into the preferred location. |
| 47 | + mkdir -p $out/share/biplanes-revival |
| 48 | + mv $out/bin/assets $out/share/biplanes-revival |
| 49 | +
|
| 50 | + # Remove TimeUtils headers. |
| 51 | + rm -rf $out/include |
| 52 | + ''; |
| 53 | + |
| 54 | + postFixup = '' |
| 55 | + # Set assets root, the default is the current working directory. |
| 56 | + # The game automatically appends "/assets" to the variable. |
| 57 | + wrapProgram $out/bin/BiplanesRevival \ |
| 58 | + --set BIPLANES_ASSETS_ROOT "$out/share/biplanes-revival"; |
| 59 | + ''; |
| 60 | + |
| 61 | + env.NIX_CFLAGS_COMPILE = "-I ../deps/TimeUtils/include"; |
| 62 | + |
| 63 | + passthru.updateScript = nix-update-script { }; |
| 64 | + |
| 65 | + meta = { |
| 66 | + mainProgram = "BiplanesRevival"; |
| 67 | + description = "Old cellphone arcade recreated for PC"; |
| 68 | + homepage = "https://regular-dev.org/biplanes-revival"; |
| 69 | + changelog = "https://github.com/regular-dev/biplanes-revival/releases/tag/v${finalAttrs.version}"; |
| 70 | + license = lib.licenses.gpl3Only; |
| 71 | + platforms = lib.platforms.unix; |
| 72 | + maintainers = with lib.maintainers; [ federicoschonborn ]; |
| 73 | + }; |
| 74 | +}) |
0 commit comments