nixpkgs/pkgs/games/bugdom/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

91 lines
2.3 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
SDL2,
IOKit,
Foundation,
OpenGL,
cmake,
makeWrapper,
}:
stdenv.mkDerivation rec {
pname = "bugdom";
version = "1.3.4";
src = fetchFromGitHub {
owner = "jorio";
repo = pname;
rev = version;
hash = "sha256-0c7v5tSqYuqtLOFl4sqD7+naJNqX/wlKHVntkZQGJ8A=";
fetchSubmodules = true;
};
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
# Expects SDL2.framework in specific location, which we don't have
# Passing this in cmakeFlags doesn't work because the path is hard-coded for Darwin
substituteInPlace cmake/FindSDL2.cmake \
--replace 'set(SDL2_LIBRARIES' 'set(SDL2_LIBRARIES "${SDL2}/lib/libSDL2.dylib") #'
# Expects plutil, which we don't have
sed -i '/plutil/d' CMakeLists.txt
'';
buildInputs =
[
SDL2
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
IOKit
Foundation
OpenGL
];
nativeBuildInputs = [
cmake
makeWrapper
];
cmakeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
"-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
# Expects SDL2.framework in specific location, which we don't have
"-DSDL2_INCLUDE_DIRS=${SDL2.dev}/include/SDL2"
];
installPhase =
''
runHook preInstall
''
+ (
if stdenv.hostPlatform.isDarwin then
''
mkdir -p $out/{bin,Applications}
mv {,$out/Applications/}Bugdom.app
makeWrapper $out/{Applications/Bugdom.app/Contents/MacOS,bin}/Bugdom
''
else
''
mkdir -p $out/share/bugdom
mv Data $out/share/bugdom
install -Dm755 {.,$out/bin}/Bugdom
wrapProgram $out/bin/Bugdom --run "cd $out/share/bugdom"
install -Dm644 $src/packaging/io.jor.bugdom.desktop $out/share/applications/io.jor.bugdom.desktop
install -Dm644 $src/packaging/io.jor.bugdom.png $out/share/pixmaps/io.jor.bugdom.png
''
)
+ ''
runHook postInstall
'';
meta = with lib; {
description = "Port of Bugdom, a 1999 Macintosh game by Pangea Software, for modern operating systems";
homepage = "https://github.com/jorio/Bugdom";
license = with licenses; [ cc-by-sa-40 ];
maintainers = with maintainers; [ lux ];
mainProgram = "Bugdom";
platforms = platforms.unix;
};
}