nixpkgs/pkgs/by-name/th/the-powder-toy/package.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

76 lines
1.3 KiB
Nix

{
bzip2,
Cocoa,
copyDesktopItems,
curl,
fetchFromGitHub,
fftwFloat,
jsoncpp,
lib,
libpng,
lua,
luajit,
meson,
ninja,
pkg-config,
SDL2,
stdenv,
zlib,
}:
stdenv.mkDerivation rec {
pname = "the-powder-toy";
version = "98.2.365";
src = fetchFromGitHub {
owner = "The-Powder-Toy";
repo = "The-Powder-Toy";
rev = "refs/tags/v${version}";
hash = "sha256-S2aUa25EnUfX6ShW6D+wHrsTLxTcCFcZ/uLE9EWGu4Q=";
};
nativeBuildInputs = [
meson
ninja
pkg-config
] ++ lib.optional stdenv.hostPlatform.isLinux copyDesktopItems;
buildInputs = [
bzip2
curl
fftwFloat
jsoncpp
libpng
lua
luajit
SDL2
zlib
] ++ lib.optional stdenv.hostPlatform.isDarwin Cocoa;
mesonFlags = [ "-Dworkaround_elusive_bzip2=false" ];
installPhase = ''
runHook preInstall
install -Dm 755 powder $out/bin/powder
mkdir -p $out/share
mv ../resources $out/share
runHook postInstall
'';
desktopItems = [ "resources/powder.desktop" ];
meta = with lib; {
description = "Free 2D physics sandbox game";
homepage = "https://powdertoy.co.uk/";
platforms = platforms.unix;
license = licenses.gpl3Plus;
maintainers = with maintainers; [
abbradar
siraben
];
mainProgram = "powder";
};
}