From b770a77257751bb7b9ade63c629ade1874b346da Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 6 Sep 2024 01:41:20 +0000 Subject: [PATCH] stepmania: simplify the wrapping --- hosts/common/programs/stepmania.nix | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hosts/common/programs/stepmania.nix b/hosts/common/programs/stepmania.nix index 62656e1da..4808f08cb 100644 --- a/hosts/common/programs/stepmania.nix +++ b/hosts/common/programs/stepmania.nix @@ -1,6 +1,5 @@ # configuration: -# - things like calibration data live in ~/.local/share/stepmania/Save/Preferences.ini -# or try ~/.stepmania-5.1 if that fails +# - things like calibration data live in ~/.stepmania-5.1/Save/Preferences.ini # - GlobalOffsetSeconds = difference between audio and video delay. # Hit F6 twice in-game to being auto calibration # Usually the result will be negative (i.e. the higher the latency of the pad, the more negative the offset) @@ -14,7 +13,7 @@ # - https://fitupyourstyle.com/ # allows search by difficulty # - dl packs from -{ config, lib, pkgs, ... }: +{ lib, pkgs, ... }: { sane.programs.stepmania = { buildCost = 1; @@ -24,15 +23,13 @@ pkgs.makeWrapper ]; } '' - # stepmania expects the current working directory to be the same directory where all its data resides. - # so we create such a directory, and a wrapper which `cd`s into it before launch + # stepmania search assets in ~/.stepmania-5.1, followed by the current working directory. + # therefore, create a wrapper which cd's to the directory holding all the builtin assets before launching the program. + # TODO: this can be simplified and included into nixpkgs' stepmania package mkdir -p $out/share/stepmania - for shipDir in Announcers BackgroundEffects BackgroundTransitions BGAnimations Characters Data Docs NoteSkins Scripts Themes; do + for shipDir in Announcers BackgroundEffects BackgroundTransitions BGAnimations Cache Characters Courses Data Docs NoteSkins Save Scripts Songs Themes; do ln -s ${pkgs.stepmania}/stepmania-5.1/$shipDir $out/share/stepmania/$shipDir done - for userDir in Cache Courses Save Songs; do - ln -s /home/${config.sane.defaultUser}/.local/share/stepmania/$userDir $out/share/stepmania/$userDir - done makeWrapper ${lib.getExe pkgs.stepmania} $out/share/stepmania/stepmania \ --run "cd $out/share/stepmania" @@ -51,14 +48,17 @@ "/dev/input" "/sys/class/input" ]; + sandbox.extraHomePaths = [ + ".stepmania-5.1" + ]; persist.byStore.plaintext = [ - ".local/share/stepmania/Cache" #< otherwise gotta index all the songs every launch - ".local/share/stepmania/Save" + ".stepmania-5.1/Cache" #< otherwise gotta index all the songs every launch + ".stepmania-5.1/Save" ]; # TODO: setup ~/.local/share/stepmania/Themes - fs.".local/share/stepmania/Courses".symlink.target = "/mnt/servo/media/games/stepmania/Courses"; - fs.".local/share/stepmania/Songs".symlink.target = "/mnt/servo/media/games/stepmania/Songs"; + fs.".stepmania-5.1/Courses".symlink.target = "/mnt/servo/media/games/stepmania/Courses"; + fs.".stepmania-5.1/Songs".symlink.target = "/mnt/servo/media/games/stepmania/Songs"; }; }