|
| 1 | +{ |
| 2 | + stdenv, |
| 3 | + lib, |
| 4 | + fetchFromGitHub, |
| 5 | + rustPlatform, |
| 6 | + fetchpatch, |
| 7 | + cmake, |
| 8 | + pkg-config, |
| 9 | + alsa-lib, |
| 10 | + nix-update-script, |
| 11 | + writableTmpDirAsHomeHook, |
| 12 | + versionCheckHook, |
| 13 | + withRadio ? false, |
| 14 | +}: |
| 15 | + |
| 16 | +rustPlatform.buildRustPackage (finalAttrs: { |
| 17 | + pname = "rebels-in-the-sky"; |
| 18 | + version = "1.0.29"; |
| 19 | + |
| 20 | + src = fetchFromGitHub { |
| 21 | + owner = "ricott1"; |
| 22 | + repo = "rebels-in-the-sky"; |
| 23 | + tag = "v${finalAttrs.version}"; |
| 24 | + hash = "sha256-rWBaD4nxSmr1RZRbc51Sz9Xl2Te2yv4HNuFqWj8KayM="; |
| 25 | + }; |
| 26 | + useFetchCargoVendor = true; |
| 27 | + cargoHash = "sha256-ZRxq6/mgXZ33o1AEHnSOt4HJAI1y+F+ysVNvvbb9M28="; |
| 28 | + |
| 29 | + patches = |
| 30 | + lib.optionals (!withRadio) [ |
| 31 | + ./disable-radio.patch |
| 32 | + ] |
| 33 | + ++ [ |
| 34 | + # https://github.com/ricott1/rebels-in-the-sky/pull/25 |
| 35 | + (fetchpatch { |
| 36 | + url = "https://github.com/ricott1/rebels-in-the-sky/commit/31778fee783637fe8af09f71754f35c5d15b800a.patch"; |
| 37 | + hash = "sha256-PO/aY+fB72gQpxE5eaIP/s4xevfQ/Ac1TH5ZEKwpw1I="; |
| 38 | + }) |
| 39 | + ]; |
| 40 | + |
| 41 | + nativeBuildInputs = |
| 42 | + [ |
| 43 | + cmake |
| 44 | + pkg-config |
| 45 | + ] |
| 46 | + ++ lib.optionals stdenv.hostPlatform.isDarwin [ |
| 47 | + rustPlatform.bindgenHook |
| 48 | + ]; |
| 49 | + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib ]; |
| 50 | + |
| 51 | + nativeCheckInputs = [ |
| 52 | + # Save system tests write to home dir |
| 53 | + writableTmpDirAsHomeHook |
| 54 | + ]; |
| 55 | + |
| 56 | + nativeInstallCheckInputs = [ |
| 57 | + versionCheckHook |
| 58 | + ]; |
| 59 | + versionCheckProgram = "${placeholder "out"}/bin/rebels"; |
| 60 | + versionCheckProgramArg = "--version"; |
| 61 | + # Darwin: "Error: Operation not permitted (os error 1)" |
| 62 | + doInstallCheck = !stdenv.hostPlatform.isDarwin; |
| 63 | + |
| 64 | + passthru.updateScript = nix-update-script { }; |
| 65 | + |
| 66 | + meta = { |
| 67 | + description = "P2P terminal game about spacepirates playing basketball across the galaxy"; |
| 68 | + longDescription = '' |
| 69 | + It's the year 2101. Corporations have taken over the world. The only way to be free is |
| 70 | + to join a pirate crew and start plundering the galaxy. The only means of survival is |
| 71 | + to play basketball. |
| 72 | +
|
| 73 | + Now it's your turn to go out there and make a name for yourself. Create your crew and |
| 74 | + start wandering the galaxy in search of worthy basketball opponents. |
| 75 | + ''; |
| 76 | + homepage = "https://frittura.org/"; |
| 77 | + changelog = "https://github.com/ricott1/rebels-in-the-sky/releases/tag/v${finalAttrs.version}"; |
| 78 | + license = |
| 79 | + with lib.licenses; |
| 80 | + [ gpl3Only ] |
| 81 | + # The original game soundtrack was generated using AI so its licensing is unclear. |
| 82 | + # I couldn't find licensing information regarding other radio stations, so I'm |
| 83 | + # assuming they're nonfree. |
| 84 | + ++ lib.optionals withRadio [ unfree ]; |
| 85 | + maintainers = with lib.maintainers; [ marcin-serwin ]; |
| 86 | + mainProgram = "rebels"; |
| 87 | + }; |
| 88 | +}) |
0 commit comments