nixpkgs/pkgs/games/space-orbit/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

48 lines
1.2 KiB
Nix

{ lib, stdenv, fetchurl
, libGLU, libGL, libXi, libXt, libXext, libX11, libXmu, libglut
}:
stdenv.mkDerivation rec {
pname = "space-orbit";
version = "1.01";
patchversion = "9";
buildInputs = [ libGLU libGL libXi libXt libXext libX11 libXmu libglut ];
src = fetchurl {
url = "mirror://debian/pool/main/s/space-orbit/space-orbit_${version}.orig.tar.gz";
sha256 = "1kx69f9jqnfzwjh47cl1df8p8hn3bnp6bznxnb6c4wx32ijn5gri";
};
patches = [
(fetchurl {
url = "mirror://debian/pool/main/s/space-orbit/space-orbit_${version}-${patchversion}.diff.gz";
sha256 = "1v3s97day6fhv08l2rn81waiprhi1lfyjjsj55axfh6n6zqfn1w2";
})
];
preBuild = ''
cd src
sed -e 's@/usr/share/games/orbit/@'$out'/dump/@g' -i *.c
sed -e '/DIR=/d; s/-lesd//; s/-DESD//;' -i Makefile
'';
installPhase = ''
mkdir -p $out/bin
cp -r .. $out/dump
cat >$out/bin/space-orbit <<EOF
#! ${stdenv.shell}
exec $out/dump/orbit "\$@"
EOF
chmod a+x $out/bin/space-orbit
'';
meta = with lib; {
broken = stdenv.hostPlatform.isDarwin;
description = "Space combat simulator";
mainProgram = "space-orbit";
license = licenses.gpl2Plus;
platforms = platforms.all;
};
}