···11-{ lib, stdenv
11+{ lib
22+, stdenv
23, fetchFromGitHub
33-, python3
44-, pkg-config
55-, audiofile
66-, SDL2
77-, hexdump
88-, requireFile
99-, compileFlags ? [ ]
1010-, region ? "us"
1111-, baseRom ? requireFile {
1212- name = "baserom.${region}.z64";
1313- message = ''
1414- This nix expression requires that baserom.${region}.z64 is
1515- already part of the store. To get this file you can dump your Super Mario 64 cartridge's contents
1616- and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
1717- Note that if you are not using a US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
1818- '';
1919- sha256 = {
2020- "us" = "17ce077343c6133f8c9f2d6d6d9a4ab62c8cd2aa57c40aea1f490b4c8bb21d91";
2121- "eu" = "c792e5ebcba34c8d98c0c44cf29747c8ee67e7b907fcc77887f9ff2523f80572";
2222- "jp" = "9cf7a80db321b07a8d461fe536c02c87b7412433953891cdec9191bfad2db317";
2323- }.${region};
2424- }
44+, callPackage
55+, autoPatchelfHook
66+, branch
257}:
2682727-stdenv.mkDerivation rec {
2828- pname = "sm64ex";
2929- version = "unstable-2021-11-30";
3030-3131- src = fetchFromGitHub {
3232- owner = "sm64pc";
3333- repo = "sm64ex";
3434- rev = "db9a6345baa5acb41f9d77c480510442cab26025";
3535- sha256 = "sha256-q7JWDvNeNrDpcKVtIGqB1k7I0FveYwrfqu7ZZK7T8F8=";
3636- };
3737-3838- nativeBuildInputs = [ python3 pkg-config ];
3939- buildInputs = [ audiofile SDL2 hexdump ];
99+{
1010+ sm64ex = callPackage ./generic.nix {
1111+ pname = "sm64ex";
1212+ version = "0.pre+date=2021-11-30";
40134141- makeFlags = [ "VERSION=${region}" ] ++ compileFlags
4242- ++ lib.optionals stdenv.isDarwin [ "OSX_BUILD=1" ];
1414+ src = fetchFromGitHub {
1515+ owner = "sm64pc";
1616+ repo = "sm64ex";
1717+ rev = "db9a6345baa5acb41f9d77c480510442cab26025";
1818+ sha256 = "sha256-q7JWDvNeNrDpcKVtIGqB1k7I0FveYwrfqu7ZZK7T8F8=";
1919+ };
43204444- inherit baseRom;
2121+ extraMeta = {
2222+ homepage = "https://github.com/sm64pc/sm64ex";
2323+ description = "Super Mario 64 port based off of decompilation";
2424+ };
2525+ };
45264646- preBuild = ''
4747- patchShebangs extract_assets.py
4848- cp $baseRom ./baserom.${region}.z64
4949- '';
2727+ sm64ex-coop = callPackage ./generic.nix {
2828+ pname = "sm64ex-coop";
2929+ version = "0.pre+date=2022-05-14";
50305151- installPhase = ''
5252- mkdir -p $out/bin
5353- cp build/${region}_pc/sm64.${region}.f3dex2e $out/bin/sm64ex
5454- '';
3131+ src = fetchFromGitHub {
3232+ owner = "djoslin0";
3333+ repo = "sm64ex-coop";
3434+ rev = "8200b175607fe2939f067d496627c202a15fe24c";
3535+ sha256 = "sha256-c1ZmMBtvYYcaJ/WxkZBVvNGVCeSXfm8NKe/BiAIJtks=";
3636+ };
55375656- enableParallelBuilding = true;
3838+ extraNativeBuildInputs = [
3939+ autoPatchelfHook
4040+ ];
57415858- meta = with lib; {
5959- homepage = "https://github.com/sm64pc/sm64ex";
6060- description = "Super Mario 64 port based off of decompilation";
6161- longDescription = ''
6262- Super Mario 64 port based off of decompilation.
6363- Note that you must supply a baserom yourself to extract assets from.
6464- If you are not using an US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
6565- If you would like to use patches sm64ex distributes as makeflags, add them to the "compileFlags" attribute.
4242+ postInstall = let
4343+ sharedLib = stdenv.hostPlatform.extensions.sharedLibrary;
4444+ in ''
4545+ mkdir -p $out/lib
4646+ cp $src/lib/bass/libbass{,_fx}${sharedLib} $out/lib
4747+ cp $src/lib/discordsdk/libdiscord_game_sdk${sharedLib} $out/lib
6648 '';
6767- license = licenses.unfree;
6868- maintainers = with maintainers; [ ivar ];
6969- platforms = platforms.unix;
4949+5050+ extraMeta = {
5151+ homepage = "https://github.com/djoslin0/sm64ex-coop";
5252+ description = "Super Mario 64 online co-op mod, forked from sm64ex";
5353+ };
7054 };
7171-}
5555+}.${branch}
+83
pkgs/games/sm64ex/generic.nix
···11+{ pname
22+, version
33+, src
44+, extraNativeBuildInputs ? [ ]
55+, extraMeta ? {}
66+, compileFlags ? [ ]
77+, postInstall ? ""
88+, region ? "us"
99+1010+, lib
1111+, stdenv
1212+, fetchFromGitHub
1313+, python3
1414+, pkg-config
1515+, audiofile
1616+, SDL2
1717+, hexdump
1818+, requireFile
1919+, baseRom ? requireFile {
2020+ name = "baserom.${region}.z64";
2121+ message = ''
2222+ This nix expression requires that baserom.${region}.z64 is
2323+ already part of the store. To get this file you can dump your Super Mario 64 cartridge's contents
2424+ and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
2525+ Note that if you are not using a US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
2626+ '';
2727+ sha256 = {
2828+ "us" = "17ce077343c6133f8c9f2d6d6d9a4ab62c8cd2aa57c40aea1f490b4c8bb21d91";
2929+ "eu" = "c792e5ebcba34c8d98c0c44cf29747c8ee67e7b907fcc77887f9ff2523f80572";
3030+ "jp" = "9cf7a80db321b07a8d461fe536c02c87b7412433953891cdec9191bfad2db317";
3131+ }.${region};
3232+ }
3333+}:
3434+3535+stdenv.mkDerivation rec {
3636+ inherit pname version src postInstall;
3737+3838+ nativeBuildInputs = [
3939+ python3
4040+ pkg-config
4141+ hexdump
4242+ ] ++ extraNativeBuildInputs;
4343+4444+ buildInputs = [
4545+ audiofile
4646+ SDL2
4747+ ];
4848+4949+ enableParallelBuilding = true;
5050+5151+ makeFlags = [
5252+ "VERSION=${region}"
5353+ ] ++ lib.optionals stdenv.isDarwin [
5454+ "OSX_BUILD=1"
5555+ ] ++ compileFlags;
5656+5757+ preBuild = ''
5858+ patchShebangs extract_assets.py
5959+ ln -s ${baseRom} ./baserom.${region}.z64
6060+ '';
6161+6262+ installPhase = ''
6363+ runHook preInstall
6464+6565+ mkdir -p $out/bin
6666+ cp build/${region}_pc/sm64.${region}.f3dex2e $out/bin/sm64ex
6767+6868+ runHook postInstall
6969+ '';
7070+7171+ meta = with lib; {
7272+ longDescription =
7373+ extraMeta.description or "Super Mario 64 port based off of decompilation" + "\n" + ''
7474+ Note that you must supply a baserom yourself to extract assets from.
7575+ If you are not using an US baserom, you must overwrite the "region" attribute with either "eu" or "jp".
7676+ If you would like to use patches sm64ex distributes as makeflags, add them to the "compileFlags" attribute.
7777+ '';
7878+ mainProgram = "sm64ex";
7979+ license = licenses.unfree;
8080+ maintainers = with maintainers; [ ivar ];
8181+ platforms = platforms.unix;
8282+ } // extraMeta;
8383+}