NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.96k stars 13.97k forks source link

Package request: Fightcade #253698

Open blueOkiris opened 1 year ago

blueOkiris commented 1 year ago

Project description

From their website:

Play arcade games online.

THE BEST WAY TO PLAY RETRO GAMES ONLINE

Fightcade is a matchmaking platform for retro gaming, bundled with different emulators for seamless online play.

It's basically a way to play old fighting games like Street Fighter III: Third Strike with others online with rollback.

Metadata


It's already packaged as a flatpak, and I think the tar it gives you from their website is self-contained, so it shouldn't be that difficult to package (I just don't know how to do that yet)

blueOkiris commented 1 year ago

The package will also want to apply the auto-download patch that everyone uses, since it won't be able to manually installed otherwise I think:

https://fightcade.guide/

blueOkiris commented 1 year ago

I tried to hack together something to throw into my configuration.nix for now:

let
    fightcade = pkgs.stdenv.mkDerivation rec {
        name = "fightcade";
        src = builtins.fetchTarball {
            url = "https://web.fightcade.com/download/Fightcade-linux-latest.tar.gz";
            sha256 = "0680q7j6lk13cd7kf2by029lxvbxr7hzh8g44pnm23ywfrfgh4qs";
        };
        buildPhase = ''
            mkdir -p $out/bin
            cp -ra *.sh $out/bin
            cp -ra *.desktop $out/bin
            cp -ra emulator/ $out/bin
            cp -ra fc2-electron/ $out/bin
            cp -ra ROMs/ $out/bin
            cp -ra fcade-upd $out/bin
        '';
        installPhase = ''
        '';
    };

But when trying to run Fightcade2.sh, it tries to modify itself, which obv it can't from the store, so that may be an issue when trying to create the package.

If you look in the flatpak yaml:

# A lot of things need to be symlinked to writable files. Fightcade
# expects to be able to write to files in its subdirectories,
# /app/fightcade/Fightcade is r/o in Flatpak.

Idk how you'd go about making this where it can modify itself, but that's one challenge to packaging Fightcade

blueOkiris commented 1 year ago

Recommend just use flatpak for now

AeronSor commented 3 months ago

Also wondering how one would go about packaging Fightcade.

blueOkiris commented 3 months ago

You can run it from source with this shell.nix:

{ pkgs ? import <nixpkgs> { } }:

let
    buildLibs = with pkgs; (with xorg; [
        alsa-lib
        atk
        cairo
        cups
        dbus
        expat
        gdk-pixbuf
        glib
        gtk3
        libdrm
        libX11
        libxcb
        libXcomposite
        libXcursor
        libXdamage
        libXext
        libXfixes
        libXi
        libXrandr
        libXrender
        libXScrnSaver
        libXtst
        mesa
        nss
        nspr
        pango
    ]);
in with pkgs; with xorg; mkShell {
    buildInputs = [
    ]++ buildLibs;
    shellHook = ''
        export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${lib.makeLibraryPath buildLibs}"
    '';
}

Haven't gotten auto-rom-download to work yet, but it's a start

blueOkiris commented 2 months ago

I got it working manually. I had to launch nix-shell, put the auto-download jsons in emulator/, a la the guide, soft link wine: sudo ln -s /run/current-system/sw/bin/wine /usr/bin/wine, then run with custom wine prefix: WINEARCH=win64 WINEPREFIX=$(pwd)/.wine ./Fightcade2.sh

blueOkiris commented 2 months ago

Perhaps the roms folder and the wine prefix (i.e. the non-static things) for the install folder fightcade could point to ~/.fightcade/ROMs and ~/.fightcade/wine.

Then the package could download the .tar.xz, extract it, create a new .desktop, and download the json files into the emulator/ folder and that stuff can go in /nix/store. Don't know what to do about Fightcade requiring /usr/bin/wine to exist. Probably not best to have a soft link.

Idk really know how to make packages tho, but with what files go where and now the dependencies known, is it possible someone who knows what they're doing could write up a package expression?

Just happy I can play for now at least. Hopefully others who want to use Fightcade can get it working until I or someone else figures out the package.