Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perfect_dark: init at 0-unstable-2025-01-05 #306767

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15901,6 +15901,13 @@
githubId = 25278658;
name = "Patrick Widmer";
};
PaulGrandperrin = {
name = "Paul Grandperrin";
email = "[email protected]";
github = "PaulGrandperrin";
githubId = 1748936;
keys = [ { fingerprint = "FEDA B009 17FA A574 F536 ED52 4AB1 3530 3377 4DA3"; } ];
};
paulsmith = {
email = "[email protected]";
github = "paulsmith";
Expand Down
114 changes: 114 additions & 0 deletions pkgs/by-name/pe/perfect_dark/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
romID ? "ntsc-final",

lib,

fetchFromGitHub,
stdenv,

SDL2,
zlib,

pkg-config,
cmake,
python3,
}:
let
roms = [
"ntsc-final"
"pal-final"
"jpn-final"
];
in
assert lib.assertOneOf "romID" romID roms;
stdenv.mkDerivation rec {
pname = "perfect_dark";
version = "0-unstable-2025-01-05";

src = fetchFromGitHub {
owner = "fgsfdsfgs";
repo = "perfect_dark";
rev = "4f7817a0ca83a893ee515854ff4f93415810810a";
hash = "sha256-J5dNkA8xXk5HgKpF+PMGSbH6Hj4M6dKp599C0PnaLT0=";
};

buildInputs = [
SDL2
zlib
];

nativeBuildInputs = [
pkg-config
cmake
python3
PaulGrandperrin marked this conversation as resolved.
Show resolved Hide resolved
];

# the project uses git to retrieve version informations but our fetcher deletes the .git
# so we replace the commands with the correct data directly
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail 'git rev-parse --short HEAD' 'echo ${builtins.substring 0 9 src.rev}' \
--replace-fail 'git rev-parse --abbrev-ref HEAD' 'echo port'
'';

enableParallelBuilding = true;

hardeningDisable = [ "format" ]; # otherwise fails to build
hardeningEnable = [ "pie" ];

preConfigure = ''
patchShebangs .
'';

cmakeFlags = [
"-DROMID=${romID}"
];

installPhase = ''
runHook preInstall
pushd ..
install -Dm 755 build/pd.x86_64 $out/bin/pd
install -Dm 644 dist/linux/*.desktop -t $out/share/applications/
install -Dm 644 dist/linux/*.png -t $out/share/pixmaps/
popd
runHook postInstall
'';

meta = {
homepage = "https://github.com/fgsfdsfgs/perfect_dark/";
description = "Modern cross-platform port of Perfect Dark";
longDescription = ''
This is a port of Ryan Dywer's decompilation of classic N64 shooter Perfect Dark to modern systems.
You'll need to provide a copy of the ROM at $HOME/.local/share/perfectdark/data/pd.${romID}.z64 to launch to game.
You can also change the ROM variant of this game with an expression like this:
PaulGrandperrin marked this conversation as resolved.
Show resolved Hide resolved
`pd.override { romID = "jpn-final" }`
PaulGrandperrin marked this conversation as resolved.
Show resolved Hide resolved
Supported romIDs are `${lib.generators.toPretty { } roms}`.
`ntsc-final` the default as it is the only recommended one by upstream.
PaulGrandperrin marked this conversation as resolved.
Show resolved Hide resolved
'';
mainProgram = "pd";
platforms = [
#"i686-linux"
"x86_64-linux"
];
maintainers = with lib.maintainers; [ PaulGrandperrin ];
license = with lib.licenses; [
# perfect_dark, khrplatform.h, port/fast3d
mit
# tools/mkrom/gzip
gpl3Plus
# the project's original work is licensed under MIT
# but a lot of it can be seen as a derivative work of an unfree piece of software
# we account for that here
unfree
PaulGrandperrin marked this conversation as resolved.
Show resolved Hide resolved
];
};
}
Loading