commit e6cd59465f172141d7972039ec58a8ca59e196d8 Author: brian Date: Fri Jun 19 14:50:43 2026 -0400 working so far diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9e4e755 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# Nix build artefacts +result +result-* + +# Editor noise +.direnv/ +.envrc +*.swp +*~ +.vscode/ +.idea/ + +# macOS +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..244d720 --- /dev/null +++ b/README.md @@ -0,0 +1,129 @@ +# skate3recomp — NixOS package + +Nix packaging for [skate3recomp](https://github.com/mchughalex/skate3recomp), an unofficial native +recompilation of the Xbox 360 version of Skate 3 for Windows and Linux. + +> **You must own a legitimate Xbox 360 copy of Skate 3.** +> This package does not include retail game files. + +--- + +## Files + +| File | Purpose | +|---|---| +| `package.nix` | `stdenv.mkDerivation` derivation (nixpkgs-style) | +| `default.nix` | Entry-point for `nix-build` / `nix-shell` local testing | + +--- + +## Before you build — get the SHA256 hash + +The `hash` field in `package.nix` is a placeholder. Fill it in by running: + +```bash +nix store prefetch-file --hash-type sha256 --unpack \ + https://github.com/mchughalex/skate3recomp/releases/download/v1.0.4/Skate3Recomp-Linux.zip +``` + +Paste the printed `sha256-…` value into the `hash =` line in `package.nix`. + +--- + +## Local test build + +```bash +# Build (requires allowUnfree — the upstream has no OSS licence) +NIXPKGS_ALLOW_UNFREE=1 nix-build + +# Run directly from the result symlink +./result/bin/skate3recomp +``` + +--- + +## NixOS module / overlay usage + +Add this to your flake or configuration: + +```nix +# flake.nix (packages output) +packages.x86_64-linux.skate3recomp = pkgs.callPackage ./skate3recomp/package.nix { }; + +# or as an overlay +nixpkgs.overlays = [ + (final: prev: { + skate3recomp = final.callPackage ./skate3recomp/package.nix { }; + }) +]; + +# then in environment.systemPackages or home.packages: +environment.systemPackages = [ pkgs.skate3recomp ]; +``` + +--- + +## Runtime setup + +On first launch the app shows a file-picker dialog to select your Skate 3 ISO. +Game data is extracted to `~/.local/share/skate3recomp` by default. + +To use a custom location, set `SKATE3_DATA_DIR` before launching: + +```bash +SKATE3_DATA_DIR=/mnt/games/skate3 skate3recomp +``` + +The wrapper also passes `--input_backend=sdl` automatically, which is the correct +mode for Linux (matches the upstream `run-linux.sh` script). + +### Controller input + +An Xbox controller is the recommended input method. DualShock and other +controllers work through SDL's generic XInput mapping. Keyboard controls can be +enabled in the in-game settings menu (Escape to open). + +### AMD GPU (RX 580) notes + +- The game uses **Vulkan**. Your system needs `amdvlk` or `mesa` (radv) in + `hardware.opengl.extraPackages` / `hardware.graphics.extraPackages` (NixOS 26.05+): + + ```nix + hardware.graphics = { + enable = true; + extraPackages = with pkgs; [ amdvlk mesa.drivers ]; + }; + ``` + +- RADV (Mesa) is generally preferred over AMDVLK for this type of workload. +- If you see a blank screen on Wayland, try forcing X11: + `SDL_VIDEODRIVER=x11 skate3recomp` + +--- + +## Troubleshooting + +| Symptom | Fix | +|---|---| +| `error: ... is not licensed` | Set `NIXPKGS_ALLOW_UNFREE=1` or add `nixpkgs.config.allowUnfree = true` | +| `libvulkan.so.1: cannot open` | Add `vulkan-loader` to your system packages or check GPU driver packages | +| `librexruntime.so: cannot open` | The wrapper sets `LD_LIBRARY_PATH`; if running the binary directly, set it manually: `LD_LIBRARY_PATH=$out/lib/skate3recomp ./skate3` | +| App opens but no ISO dialog | Make sure `gtk3` is available; it provides the file-picker | +| Audio crackling | v1.0.4 fixed most audio issues; if it persists, try `SDL_AUDIODRIVER=pipewire skate3recomp` | +| Wayland black screen | Set `SDL_VIDEODRIVER=x11` to fall back to XWayland | + +--- + +## How autoPatchelfHook works here + +The zip contains two prebuilt ELFs compiled on Ubuntu 24.04: + +- `skate3` — the main executable +- `librexruntime.so` — the rexglue runtime shared library + +`autoPatchelfHook` patches both binaries' `RPATH` and interpreter (`PT_INTERP`) +so they resolve against the correct Nix store paths rather than +`/lib/x86_64-linux-gnu/`. The wrapper then adds `$out/lib/skate3recomp` to +`LD_LIBRARY_PATH` so `skate3` can find `librexruntime.so` at runtime. + +No AppImage, no SquashFS offset, no FHS env needed — the zip is a plain ELF bundle. diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..f6774da --- /dev/null +++ b/default.nix @@ -0,0 +1,11 @@ +# default.nix — local test entry-point +# Usage: +# nix-build (builds the package) +# nix-shell (drops you into a shell with the package on PATH) +# +# To override nixpkgs: +# nix-build --arg nixpkgs '(import {})' + +{ nixpkgs ? import { config.allowUnfree = true; } }: + +nixpkgs.callPackage ./package.nix { } diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..5aed985 --- /dev/null +++ b/package.nix @@ -0,0 +1,99 @@ +{ + lib, + stdenv, + fetchurl, + unzip, + autoPatchelfHook, + vulkan-loader, + libGL, + SDL2, + gtk3, + alsa-lib, + libpulseaudio, + pipewire, + udev, + libusb1, + libx11, + libxcb, + bubblewrap, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "skate3recomp"; + version = "1.0.4"; + + src = fetchurl { + url = "https://github.com/mchughalex/skate3recomp/releases/download/v${finalAttrs.version}/Skate3Recomp-Linux.zip"; + hash = "sha256-+4eERneK934V8S3oF1/CJliOmFB8pwBekixCrQuhhy4="; + }; + + nativeBuildInputs = [ + unzip + autoPatchelfHook + bubblewrap + ]; + + buildInputs = [ + stdenv.cc.cc.lib # libstdc++, libgcc_s + vulkan-loader # libvulkan.so.1 + libGL # libGL.so.1 (Mesa / AMDGPU) + SDL2 # libSDL2-2.0.so.0 + gtk3 # libgtk-3.so.0 (file-picker dialog for ISO selection) + alsa-lib # libasound.so.2 + libpulseaudio # libpulse.so.0 + pipewire # libpipewire-0.3.so.0 + udev # libudev.so.1 + libusb1 # libusb-1.0.so.0 + libx11 # libX11.so.6 + libxcb # libxcb.so.1 + ]; + + autoPatchelfIgnoreMissingDeps = [ "libsteam_api.so" ]; + + dontBuild = true; + dontConfigure = true; + + installPhase = '' + runHook preInstall + + install -Dm755 skate3 "$out/lib/skate3recomp/skate3" + install -Dm755 librexruntime.so "$out/lib/skate3recomp/librexruntime.so" + + mkdir -p "$out/bin" + cat > "$out/bin/skate3recomp" << WRAPPER + #!/usr/bin/env bash + export LD_LIBRARY_PATH="$out/lib/skate3recomp:${vulkan-loader}/lib\''${LD_LIBRARY_PATH:+:\''${LD_LIBRARY_PATH}}" + dataDir="\''${SKATE3_DATA_DIR:-\$HOME/.local/share/skate3recomp}" + mkdir -p "\$dataDir/logs" + exec ${bubblewrap}/bin/bwrap \ + --bind / / \ + --dev /dev \ + --proc /proc \ + --tmpfs "$out/lib/skate3recomp" \ + --bind "$out/lib/skate3recomp/skate3" "$out/lib/skate3recomp/skate3" \ + --bind "$out/lib/skate3recomp/librexruntime.so" "$out/lib/skate3recomp/librexruntime.so" \ + --bind "\$dataDir/logs" "$out/lib/skate3recomp/logs" \ + -- "$out/lib/skate3recomp/skate3" --input_backend=sdl --game_data_root="\$dataDir" "\$@" + WRAPPER + chmod +x "$out/bin/skate3recomp" + + runHook postInstall + ''; + + meta = { + description = "Unofficial native recompilation of the Xbox 360 version of Skate 3"; + longDescription = '' + skate3recomp is an unofficial native PC recompilation of Skate 3 (Xbox 360), + built with the rexglue recompilation SDK. You must supply your own legally + obtained Xbox 360 ISO of Skate 3; the project does not include retail game files. + + On first launch, click "Select ISO" and point the app at your ISO. Game data + will be extracted to ''${SKATE3_DATA_DIR:-~/.local/share/skate3recomp}. + ''; + homepage = "https://github.com/mchughalex/skate3recomp"; + license = lib.licenses.unfree; + platforms = [ "x86_64-linux" ]; + maintainers = [ ]; + sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; + }; +}) \ No newline at end of file