stepmania: simplify the wrapping

This commit is contained in:
2024-09-06 01:41:20 +00:00
parent b289f13779
commit b770a77257

View File

@@ -1,6 +1,5 @@
# configuration: # configuration:
# - things like calibration data live in ~/.local/share/stepmania/Save/Preferences.ini # - things like calibration data live in ~/.stepmania-5.1/Save/Preferences.ini
# or try ~/.stepmania-5.1 if that fails
# - GlobalOffsetSeconds = difference between audio and video delay. # - GlobalOffsetSeconds = difference between audio and video delay.
# Hit F6 twice in-game to being auto calibration # 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) # 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/ # - https://fitupyourstyle.com/
# allows search by difficulty # allows search by difficulty
# - dl packs from <https://stepmaniaonline.net> # - dl packs from <https://stepmaniaonline.net>
{ config, lib, pkgs, ... }: { lib, pkgs, ... }:
{ {
sane.programs.stepmania = { sane.programs.stepmania = {
buildCost = 1; buildCost = 1;
@@ -24,15 +23,13 @@
pkgs.makeWrapper pkgs.makeWrapper
]; ];
} '' } ''
# stepmania expects the current working directory to be the same directory where all its data resides. # stepmania search assets in ~/.stepmania-5.1, followed by the current working directory.
# so we create such a directory, and a wrapper which `cd`s into it before launch # 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 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 ln -s ${pkgs.stepmania}/stepmania-5.1/$shipDir $out/share/stepmania/$shipDir
done 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 \ makeWrapper ${lib.getExe pkgs.stepmania} $out/share/stepmania/stepmania \
--run "cd $out/share/stepmania" --run "cd $out/share/stepmania"
@@ -51,14 +48,17 @@
"/dev/input" "/dev/input"
"/sys/class/input" "/sys/class/input"
]; ];
sandbox.extraHomePaths = [
".stepmania-5.1"
];
persist.byStore.plaintext = [ persist.byStore.plaintext = [
".local/share/stepmania/Cache" #< otherwise gotta index all the songs every launch ".stepmania-5.1/Cache" #< otherwise gotta index all the songs every launch
".local/share/stepmania/Save" ".stepmania-5.1/Save"
]; ];
# TODO: setup ~/.local/share/stepmania/Themes # TODO: setup ~/.local/share/stepmania/Themes
fs.".local/share/stepmania/Courses".symlink.target = "/mnt/servo/media/games/stepmania/Courses"; fs.".stepmania-5.1/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/Songs".symlink.target = "/mnt/servo/media/games/stepmania/Songs";
}; };
} }