1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00
nixpkgs/pkgs/games/openspades/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

71 lines
2.1 KiB
Nix

{ lib, stdenv, fetchurl, fetchFromGitHub, fetchpatch, cmake, unzip, zip, file
, curl, glew , libGL, SDL2, SDL2_image, zlib, freetype, imagemagick
, openal , opusfile, libogg
, Cocoa, libXext
}:
stdenv.mkDerivation rec {
pname = "openspades";
version = "0.1.3";
devPakVersion = "33";
src = fetchFromGitHub {
owner = "yvt";
repo = "openspades";
rev = "v${version}";
sha256 = "1fvmqbif9fbipd0vphp57pk6blb4yp8xvqlc2ppipk5pjv6a3d2h";
};
nativeBuildInputs = [ cmake imagemagick unzip zip file ];
buildInputs = [
freetype SDL2 SDL2_image libGL zlib curl glew opusfile openal libogg libXext
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
Cocoa
];
patches = [
# https://github.com/yvt/openspades/pull/793 fix Darwin build
(fetchpatch {
url = "https://github.com/yvt/openspades/commit/2d13704fefc475b279337e89057b117f711a35d4.diff";
sha256 = "1i7rcpjzkjhbv5pp6byzrxv7sb1iamqq5k1vyqlvkbr38k2dz0rv";
})
];
cmakeFlags = [
"-DOPENSPADES_INSTALL_BINARY=bin"
];
devPak = fetchurl {
url = "https://github.com/yvt/openspades-paks/releases/download/r${devPakVersion}/OpenSpadesDevPackage-r${devPakVersion}.zip";
sha256 = "1bd2fyn7mlxa3xnsvzj08xjzw02baimqvmnix07blfhb78rdq9q9";
};
notoFont = fetchurl {
url = "https://github.com/yvt/openspades/releases/download/v0.1.1b/NotoFonts.pak";
sha256 = "0kaz8j85wjjnf18z0lz69xr1z8makg30jn2dzdyicd1asrj0q1jm";
};
postPatch = ''
sed -i 's,^wget .*,cp $devPak "$PAK_NAME",' Resources/downloadpak.sh
patchShebangs Resources
'';
postInstall = ''
cp $notoFont $out/share/games/openspades/Resources/
'';
NIX_CFLAGS_LINK = "-lopenal";
meta = with lib; {
description = "Compatible client of Ace of Spades 0.75";
mainProgram = "openspades";
homepage = "https://github.com/yvt/openspades/";
license = licenses.gpl3;
platforms = platforms.all;
maintainers = with maintainers; [ abbradar azahi ];
# never built on aarch64-linux since first introduction in nixpkgs
broken = stdenv.hostPlatform.isDarwin || (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
};
}