···1-{ lib, stdenv
02, fetchFromGitHub
3-, python3
4-, pkg-config
5-, audiofile
6-, SDL2
7-, hexdump
8-, requireFile
9-, compileFlags ? [ ]
10-, region ? "us"
11-, baseRom ? requireFile {
12- name = "baserom.${region}.z64";
13- message = ''
14- This nix expression requires that baserom.${region}.z64 is
15- already part of the store. To get this file you can dump your Super Mario 64 cartridge's contents
16- and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
17- Note that if you are not using a US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
18- '';
19- sha256 = {
20- "us" = "17ce077343c6133f8c9f2d6d6d9a4ab62c8cd2aa57c40aea1f490b4c8bb21d91";
21- "eu" = "c792e5ebcba34c8d98c0c44cf29747c8ee67e7b907fcc77887f9ff2523f80572";
22- "jp" = "9cf7a80db321b07a8d461fe536c02c87b7412433953891cdec9191bfad2db317";
23- }.${region};
24- }
25}:
2627-stdenv.mkDerivation rec {
28- pname = "sm64ex";
29- version = "unstable-2021-11-30";
30-31- src = fetchFromGitHub {
32- owner = "sm64pc";
33- repo = "sm64ex";
34- rev = "db9a6345baa5acb41f9d77c480510442cab26025";
35- sha256 = "sha256-q7JWDvNeNrDpcKVtIGqB1k7I0FveYwrfqu7ZZK7T8F8=";
36- };
37-38- nativeBuildInputs = [ python3 pkg-config ];
39- buildInputs = [ audiofile SDL2 hexdump ];
4041- makeFlags = [ "VERSION=${region}" ] ++ compileFlags
42- ++ lib.optionals stdenv.isDarwin [ "OSX_BUILD=1" ];
00004344- inherit baseRom;
00004546- preBuild = ''
47- patchShebangs extract_assets.py
48- cp $baseRom ./baserom.${region}.z64
49- '';
5051- installPhase = ''
52- mkdir -p $out/bin
53- cp build/${region}_pc/sm64.${region}.f3dex2e $out/bin/sm64ex
54- '';
005556- enableParallelBuilding = true;
005758- meta = with lib; {
59- homepage = "https://github.com/sm64pc/sm64ex";
60- description = "Super Mario 64 port based off of decompilation";
61- longDescription = ''
62- Super Mario 64 port based off of decompilation.
63- Note that you must supply a baserom yourself to extract assets from.
64- If you are not using an US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
65- If you would like to use patches sm64ex distributes as makeflags, add them to the "compileFlags" attribute.
66 '';
67- license = licenses.unfree;
68- maintainers = with maintainers; [ ivar ];
69- platforms = platforms.unix;
0070 };
71-}
···1+{ pname
2+, version
3+, src
4+, extraNativeBuildInputs ? [ ]
5+, extraMeta ? {}
6+, compileFlags ? [ ]
7+, postInstall ? ""
8+, region ? "us"
9+10+, lib
11+, stdenv
12+, fetchFromGitHub
13+, python3
14+, pkg-config
15+, audiofile
16+, SDL2
17+, hexdump
18+, requireFile
19+, baseRom ? requireFile {
20+ name = "baserom.${region}.z64";
21+ message = ''
22+ This nix expression requires that baserom.${region}.z64 is
23+ already part of the store. To get this file you can dump your Super Mario 64 cartridge's contents
24+ and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
25+ Note that if you are not using a US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
26+ '';
27+ sha256 = {
28+ "us" = "17ce077343c6133f8c9f2d6d6d9a4ab62c8cd2aa57c40aea1f490b4c8bb21d91";
29+ "eu" = "c792e5ebcba34c8d98c0c44cf29747c8ee67e7b907fcc77887f9ff2523f80572";
30+ "jp" = "9cf7a80db321b07a8d461fe536c02c87b7412433953891cdec9191bfad2db317";
31+ }.${region};
32+ }
33+}:
34+35+stdenv.mkDerivation rec {
36+ inherit pname version src postInstall;
37+38+ nativeBuildInputs = [
39+ python3
40+ pkg-config
41+ hexdump
42+ ] ++ extraNativeBuildInputs;
43+44+ buildInputs = [
45+ audiofile
46+ SDL2
47+ ];
48+49+ enableParallelBuilding = true;
50+51+ makeFlags = [
52+ "VERSION=${region}"
53+ ] ++ lib.optionals stdenv.isDarwin [
54+ "OSX_BUILD=1"
55+ ] ++ compileFlags;
56+57+ preBuild = ''
58+ patchShebangs extract_assets.py
59+ ln -s ${baseRom} ./baserom.${region}.z64
60+ '';
61+62+ installPhase = ''
63+ runHook preInstall
64+65+ mkdir -p $out/bin
66+ cp build/${region}_pc/sm64.${region}.f3dex2e $out/bin/sm64ex
67+68+ runHook postInstall
69+ '';
70+71+ meta = with lib; {
72+ longDescription =
73+ extraMeta.description or "Super Mario 64 port based off of decompilation" + "\n" + ''
74+ Note that you must supply a baserom yourself to extract assets from.
75+ If you are not using an US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
76+ If you would like to use patches sm64ex distributes as makeflags, add them to the "compileFlags" attribute.
77+ '';
78+ mainProgram = "sm64ex";
79+ license = licenses.unfree;
80+ maintainers = with maintainers; [ ivar ];
81+ platforms = platforms.unix;
82+ } // extraMeta;
83+}