perfect_dark: init at 0-unstable-2025-08-25 (#306767)

authored by Fernando Rodrigues and committed by GitHub d0fc3089 23e0867c

+137
+7
maintainers/maintainer-list.nix
··· 19664 19664 githubId = 81905706; 19665 19665 name = "Pau Kaifler"; 19666 19666 }; 19667 + PaulGrandperrin = { 19668 + name = "Paul Grandperrin"; 19669 + email = "paul.grandperrin@gmail.com"; 19670 + github = "PaulGrandperrin"; 19671 + githubId = 1748936; 19672 + keys = [ { fingerprint = "FEDA B009 17FA A574 F536 ED52 4AB1 3530 3377 4DA3"; } ]; 19673 + }; 19667 19674 paulsmith = { 19668 19675 email = "paulsmith@pobox.com"; 19669 19676 github = "paulsmith";
+130
pkgs/by-name/pe/perfect_dark/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + SDL2, 6 + cmake, 7 + libGL, 8 + pkg-config, 9 + python3, 10 + zlib, 11 + romID ? "ntsc-final", 12 + }: 13 + let 14 + roms = [ 15 + "ntsc-final" 16 + "pal-final" 17 + "jpn-final" 18 + ]; 19 + in 20 + assert lib.assertOneOf "romID" romID roms; 21 + 22 + stdenv.mkDerivation (finalAttrs: { 23 + pname = "perfect_dark"; 24 + version = "0-unstable-2025-08-25"; 25 + 26 + src = fetchFromGitHub { 27 + owner = "fgsfdsfgs"; 28 + repo = "perfect_dark"; 29 + rev = "bb4fcffeb5dc382fce4c609897a2e82590d7d709"; 30 + hash = "sha256-XLmAjwEzz4fPpHuk3IBmhhDfiuudwMTnYgVe6Wcfdsg="; 31 + }; 32 + 33 + enableParallelBuilding = true; 34 + 35 + # Fails to build if not set: 36 + hardeningDisable = [ "format" ]; 37 + hardeningEnable = [ "pie" ]; 38 + 39 + cmakeFlags = [ 40 + (lib.cmakeFeature "ROMID" romID) 41 + ]; 42 + 43 + nativeBuildInputs = [ 44 + cmake 45 + pkg-config 46 + python3 47 + ]; 48 + 49 + buildInputs = [ 50 + SDL2 51 + libGL 52 + zlib 53 + ]; 54 + 55 + postPatch = 56 + # The project uses Git to retrieve version informations but our 57 + # fetcher deletes the .git directory, so we replace the commands 58 + # with the correct data directly. 59 + '' 60 + substituteInPlace CMakeLists.txt \ 61 + --replace-fail "git rev-parse --short HEAD" \ 62 + "echo ${builtins.substring 0 9 finalAttrs.src.rev}" \ 63 + --replace-fail "git rev-parse --abbrev-ref HEAD" \ 64 + "echo port" 65 + '' 66 + # Point toward the compiled binary and not the shell wrapper since 67 + # the rom auto-detection logic is not needed in this build. 68 + + '' 69 + substituteInPlace dist/linux/io.github.fgsfdsfgs.perfect_dark.desktop \ 70 + --replace-fail "Exec=io.github.fgsfdsfgs.perfect_dark.sh" \ 71 + "Exec=io.github.fgsfdsfgs.perfect_dark" 72 + ''; 73 + 74 + preConfigure = '' 75 + patchShebangs --build . 76 + ''; 77 + 78 + installPhase = '' 79 + runHook preInstall 80 + 81 + pushd .. 82 + install -Dm755 build/pd.* $out/bin/io.github.fgsfdsfgs.perfect_dark 83 + install -Dm644 dist/linux/io.github.fgsfdsfgs.perfect_dark.desktop \ 84 + -t $out/share/applications 85 + install -Dm644 dist/linux/io.github.fgsfdsfgs.perfect_dark.png \ 86 + -t $out/share/icons/hicolor/256x256/apps 87 + install -Dm644 dist/linux/io.github.fgsfdsfgs.perfect_dark.metainfo.xml \ 88 + -t $out/share/metainfo 89 + popd 90 + 91 + runHook postInstall 92 + ''; 93 + 94 + meta = { 95 + description = "Modern cross-platform port of Perfect Dark"; 96 + longDescription = '' 97 + This is a port of Ryan Dywer's decompilation of classic N64 98 + shooter Perfect Dark to modern systems. 99 + 100 + You will need to provide a copy of the ROM at 101 + `$HOME/.local/share/perfectdark/data/pd.${romID}.z64` to launch 102 + the game. 103 + 104 + Though `ntsc-final` is the recommended default, you can change 105 + the ROM variant of this game with an expression like this: 106 + 107 + ```nix 108 + perfect_dark.override { romID = "jpn-final"; } 109 + ``` 110 + 111 + Supported romIDs are `${lib.generators.toPretty { } roms}`. 112 + ''; 113 + homepage = "https://github.com/fgsfdsfgs/perfect_dark/"; 114 + license = with lib.licenses; [ 115 + # perfect_dark, khrplatform.h, port/fast3d 116 + mit 117 + # Vendored source code and binaries of 'gzip'. 118 + gpl3Plus 119 + # Derivative work of "Perfect Dark" © 2000 Rare Ltd. 120 + unfree 121 + ]; 122 + maintainers = with lib.maintainers; [ 123 + PaulGrandperrin 124 + normalcea 125 + sigmasquadron 126 + ]; 127 + mainProgram = "io.github.fgsfdsfgs.perfect_dark"; 128 + platforms = lib.platforms.linux; 129 + }; 130 + })