-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
perfect_dark: init at 0-unstable-2025-08-25 #306767
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,130 @@ | ||||||
| { | ||||||
| lib, | ||||||
| stdenv, | ||||||
| fetchFromGitHub, | ||||||
| SDL2, | ||||||
| cmake, | ||||||
| libGL, | ||||||
| pkg-config, | ||||||
| python3, | ||||||
| zlib, | ||||||
| romID ? "ntsc-final", | ||||||
| }: | ||||||
| let | ||||||
| roms = [ | ||||||
| "ntsc-final" | ||||||
| "pal-final" | ||||||
| "jpn-final" | ||||||
| ]; | ||||||
| in | ||||||
| assert lib.assertOneOf "romID" romID roms; | ||||||
|
|
||||||
| stdenv.mkDerivation (finalAttrs: { | ||||||
| pname = "perfect_dark"; | ||||||
| version = "0-unstable-2025-08-25"; | ||||||
|
|
||||||
| src = fetchFromGitHub { | ||||||
| owner = "fgsfdsfgs"; | ||||||
| repo = "perfect_dark"; | ||||||
| rev = "bb4fcffeb5dc382fce4c609897a2e82590d7d709"; | ||||||
| hash = "sha256-XLmAjwEzz4fPpHuk3IBmhhDfiuudwMTnYgVe6Wcfdsg="; | ||||||
| }; | ||||||
philiptaron marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
|
||||||
| enableParallelBuilding = true; | ||||||
|
|
||||||
| # Fails to build if not set: | ||||||
| hardeningDisable = [ "format" ]; | ||||||
| hardeningEnable = [ "pie" ]; | ||||||
|
|
||||||
| cmakeFlags = [ | ||||||
| (lib.cmakeFeature "ROMID" romID) | ||||||
| ]; | ||||||
|
|
||||||
| nativeBuildInputs = [ | ||||||
| cmake | ||||||
| pkg-config | ||||||
| python3 | ||||||
PaulGrandperrin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| ]; | ||||||
|
|
||||||
| buildInputs = [ | ||||||
| SDL2 | ||||||
| libGL | ||||||
| zlib | ||||||
| ]; | ||||||
|
|
||||||
| postPatch = | ||||||
| # The project uses Git to retrieve version informations but our | ||||||
| # fetcher deletes the .git directory, so we replace the commands | ||||||
| # with the correct data directly. | ||||||
| '' | ||||||
| substituteInPlace CMakeLists.txt \ | ||||||
| --replace-fail "git rev-parse --short HEAD" \ | ||||||
| "echo ${builtins.substring 0 9 finalAttrs.src.rev}" \ | ||||||
| --replace-fail "git rev-parse --abbrev-ref HEAD" \ | ||||||
| "echo port" | ||||||
| '' | ||||||
| # Point toward the compiled binary and not the shell wrapper since | ||||||
| # the rom auto-detection logic is not needed in this build. | ||||||
| + '' | ||||||
| substituteInPlace dist/linux/io.github.fgsfdsfgs.perfect_dark.desktop \ | ||||||
| --replace-fail "Exec=io.github.fgsfdsfgs.perfect_dark.sh" \ | ||||||
| "Exec=io.github.fgsfdsfgs.perfect_dark" | ||||||
| ''; | ||||||
|
|
||||||
| preConfigure = '' | ||||||
| patchShebangs --build . | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(non-blocking): Don't recursively patch all files in source, but only the files we need for building. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These types of changes can be done in a follow-up PR, but it doesn't hurt to document them here for reference. |
||||||
| ''; | ||||||
|
|
||||||
| installPhase = '' | ||||||
| runHook preInstall | ||||||
|
|
||||||
| pushd .. | ||||||
| install -Dm755 build/pd.* $out/bin/io.github.fgsfdsfgs.perfect_dark | ||||||
| install -Dm644 dist/linux/io.github.fgsfdsfgs.perfect_dark.desktop \ | ||||||
| -t $out/share/applications | ||||||
| install -Dm644 dist/linux/io.github.fgsfdsfgs.perfect_dark.png \ | ||||||
| -t $out/share/icons/hicolor/256x256/apps | ||||||
| install -Dm644 dist/linux/io.github.fgsfdsfgs.perfect_dark.metainfo.xml \ | ||||||
| -t $out/share/metainfo | ||||||
| popd | ||||||
|
|
||||||
| runHook postInstall | ||||||
| ''; | ||||||
|
|
||||||
| meta = { | ||||||
| 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 will need to provide a copy of the ROM at | ||||||
| `$HOME/.local/share/perfectdark/data/pd.${romID}.z64` to launch | ||||||
| the game. | ||||||
|
|
||||||
| Though `ntsc-final` is the recommended default, you can change | ||||||
| the ROM variant of this game with an expression like this: | ||||||
|
|
||||||
| ```nix | ||||||
| perfect_dark.override { romID = "jpn-final"; } | ||||||
| ``` | ||||||
|
|
||||||
| Supported romIDs are `${lib.generators.toPretty { } roms}`. | ||||||
| ''; | ||||||
| homepage = "https://github.com/fgsfdsfgs/perfect_dark/"; | ||||||
| license = with lib.licenses; [ | ||||||
| # perfect_dark, khrplatform.h, port/fast3d | ||||||
| mit | ||||||
| # Vendored source code and binaries of 'gzip'. | ||||||
| gpl3Plus | ||||||
SigmaSquadron marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| # Derivative work of "Perfect Dark" © 2000 Rare Ltd. | ||||||
| unfree | ||||||
| ]; | ||||||
| maintainers = with lib.maintainers; [ | ||||||
| PaulGrandperrin | ||||||
| normalcea | ||||||
| sigmasquadron | ||||||
| ]; | ||||||
| mainProgram = "io.github.fgsfdsfgs.perfect_dark"; | ||||||
| platforms = lib.platforms.linux; | ||||||
| }; | ||||||
| }) | ||||||
Uh oh!
There was an error while loading. Please reload this page.