nixpkgs/pkgs/games/cdogs-sdl/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

65 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, SDL2
, SDL2_image
, SDL2_mixer
, cmake
, gtk3-x11
, python3
, protobuf
}:
stdenv.mkDerivation rec {
pname = "cdogs-sdl";
version = "2.1.0";
src = fetchFromGitHub {
repo = pname;
owner = "cxong";
rev = version;
sha256 = "sha256-bFHygaL0UrrprSZRPTdYIzO78IhMjiqhLCGr7TTajqc=";
};
postPatch = ''
patchShebangs src/proto/nanopb/generator/*
'';
cmakeFlags = [
"-DCDOGS_DATA_DIR=${placeholder "out"}/"
"-DCMAKE_C_FLAGS=-Wno-error=array-bounds"
];
env.NIX_CFLAGS_COMPILE = toString [
# Needed with GCC 12
"-Wno-error=stringop-overflow"
];
nativeBuildInputs = [
pkg-config
cmake
(python3.withPackages (pp: with pp; [ pp.protobuf setuptools ]))
];
buildInputs = [
SDL2
SDL2_image
SDL2_mixer
gtk3-x11
protobuf
];
# inlining failed in call to 'tinydir_open': --param max-inline-insns-single limit reached
hardeningDisable = [ "fortify3" ];
meta = with lib; {
homepage = "https://cxong.github.io/cdogs-sdl";
description = "Open source classic overhead run-and-gun game";
license = licenses.gpl2Only;
maintainers = with maintainers; [ nixinator ];
platforms = platforms.unix;
broken = stdenv.hostPlatform.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/cdogs-sdl.x86_64-darwin
};
}