fork/slippi-nix
git clone https://git.julia.blue/fork/slippi-nix
a561543
remove-trace
1# A wrapped slippi-launcher that works standalone (without the Home Manager 2# module) by seeding the config directory with correct Dolphin paths and 3# AppImage symlinks on each launch. 4{ 5lib , 6writeShellApplication , 7jq , 8slippi-launcher , 9slippi-netplay , 10slippi-netplay-beta , 11slippi-playback , 12formats , 13} : 14let 15managedSettings = ( formats . json { }). generate "slippi-managed-settings" { 16settings = { 17netplayDolphinPath = " ${ slippi-netplay } /bin/" ; 18playbackDolphinPath = " ${ slippi-playback } /bin/" ; 19autoUpdateLauncher = false ; 20}; 21}; 22in 23writeShellApplication { 24name = "slippi-launcher" ; 25runtimeInputs = [ jq ]; 26text = '' 27slippi_dir ="'' $ { XDG_CONFIG_HOME:- $ HOME /.config}/Slippi Launcher" 28settings=" $ slippi_dir/Settings" 29 30mkdir -p " $ slippi_dir/netplay" " $ slippi_dir/netplay-beta" " $ slippi_dir/playback" 31 32# Symlink Nix-wrapped AppImages and Sys directories so the launcher 33# can detect versions and Dolphin can find its system files. 34ln -sfn ${ lib . getExe slippi-netplay } " $ slippi_dir /netplay/Slippi_Online-x86_64.AppImage" 35ln -sfn ${ slippi-netplay . raw-zip } /Sys " $ slippi_dir /netplay/Sys" 36ln -sfn ${ lib . getExe slippi-netplay-beta } " $ slippi_dir /netplay-beta/Slippi_Netplay_Mainline-x86_64.AppImage" 37ln -sfn ${ slippi-netplay-beta . raw-zip } /Sys " $ slippi_dir /netplay-beta/Sys" 38ln -sfn ${ lib . getExe slippi-playback } " $ slippi_dir /playback/Slippi_Playback-x86_64.AppImage" 39ln -sfn ${ slippi-playback . raw-zip } /Sys " $ slippi_dir /playback/Sys" 40 41# Remove stale symlink from older module versions 42if [ -L " $ settings " ]; then 43rm " $ settings " 44fi 45 46if [ -f " $ settings " ]; then 47# Merge Nix-managed settings on top of existing (Nix paths win) 48jq -s '.[0] * .[1]' " $ settings " ${ managedSettings } > " $ settings .tmp" 49mv " $ settings .tmp" " $ settings " 50else 51cp ${ managedSettings } " $ settings " 52chmod u+w " $ settings " 53fi 54 55exec ${ lib . getExe slippi-launcher } " $ @" 56'' ; 57 58meta = slippi-launcher . meta // { 59description = "Slippi Launcher (standalone, pre-configured for NixOS)" ; 60}; 61}