nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchurl,
6 writeShellScriptBin,
7 cmake,
8 ninja,
9 pkg-config,
10 makeWrapper,
11 zlib,
12 libpng,
13 SDL2,
14 SDL2_net,
15 hidapi,
16 qt6,
17 vulkan-loader,
18 makeDesktopItem,
19 copyDesktopItems,
20}:
21
22let
23 cheats-json = fetchurl {
24 url = "https://raw.githubusercontent.com/simple64/cheat-parser/87963b7aca06e0d4632b66bc5ffe7d6b34060f4f/cheats.json";
25 hash = "sha256-rS/4Mdi+18C2ywtM5nW2XaJkC1YnKZPc4YdQ3mCfESU=";
26 };
27in
28stdenv.mkDerivation (finalAttrs: {
29 pname = "simple64";
30 version = "2024.12.1";
31
32 src = fetchFromGitHub {
33 owner = "simple64";
34 repo = "simple64";
35 tag = "v${finalAttrs.version}";
36 hash = "sha256-rvoUyvhpbibXbAreu6twTeeVRTCbhJiJuyKaJz0uT5k=";
37 };
38
39 patches = [
40 ./dont-use-vosk-and-discord.patch
41 ./add-official-server-error-message.patch
42 ];
43
44 postPatch = ''
45 cp ${cheats-json} cheats.json
46 '';
47
48 stictDeps = true;
49
50 nativeBuildInputs = [
51 qt6.wrapQtAppsHook
52 cmake
53 ninja
54 pkg-config
55 makeWrapper
56 copyDesktopItems
57 # fake git command for version info generator
58 (writeShellScriptBin "git" "echo ${finalAttrs.src.rev}")
59 ];
60
61 buildInputs = [
62 zlib
63 libpng
64 SDL2
65 SDL2_net
66 hidapi
67 qt6.qtbase
68 qt6.qtwebsockets
69 qt6.qtwayland
70 ];
71
72 dontUseCmakeConfigure = true;
73
74 buildPhase = ''
75 runHook preBuild
76
77 sh build.sh
78
79 runHook postBuild
80 '';
81
82 installPhase = ''
83 runHook preInstall
84
85 mkdir -p $out/share/simple64 $out/bin
86 cp -r simple64/* $out/share/simple64
87
88 install -Dm644 ./simple64-gui/icons/simple64.svg -t $out/share/icons/hicolor/scalable/apps/
89
90 patchelf $out/share/simple64/simple64-gui \
91 --add-needed libvulkan.so.1 --add-rpath ${lib.makeLibraryPath [ vulkan-loader ]}
92
93 ln -s $out/share/simple64/simple64-gui $out/bin/simple64-gui
94
95 runHook postInstall
96 '';
97
98 desktopItems = [
99 (makeDesktopItem {
100 name = "simple64";
101 desktopName = "simple64";
102 genericName = "Nintendo 64 Emulator";
103 exec = "simple64-gui";
104 mimeTypes = [ "application/x-n64-rom" ];
105 icon = "simple64";
106 terminal = false;
107 categories = [
108 "Game"
109 "Emulator"
110 ];
111 })
112 ];
113
114 meta = {
115 description = "Easy to use N64 emulator";
116 homepage = "https://simple64.github.io";
117 license = lib.licenses.gpl3Only;
118 mainProgram = "simple64-gui";
119 maintainers = with lib.maintainers; [ tomasajt ];
120 platforms = lib.platforms.linux;
121 };
122})