Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
51 lines
1.2 KiB
Nix
51 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
symlinkJoin,
|
|
makeWrapper,
|
|
}:
|
|
|
|
unwrapped:
|
|
|
|
pkgsSpec:
|
|
|
|
let
|
|
mods = if lib.isFunction pkgsSpec then pkgsSpec unwrapped.pkgs else pkgsSpec;
|
|
in
|
|
|
|
if builtins.length mods == 0 then
|
|
unwrapped
|
|
else
|
|
symlinkJoin {
|
|
name = unwrapped.name + "-with-mods";
|
|
|
|
paths = [ unwrapped ] ++ mods;
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
postBuild = ''
|
|
if [ -x $out/bin/cataclysm ]; then
|
|
wrapProgram $out/bin/cataclysm \
|
|
--add-flags "--datadir $out/share/cataclysm-dda/"
|
|
fi
|
|
if [ -x $out/bin/cataclysm-tiles ]; then
|
|
wrapProgram $out/bin/cataclysm-tiles \
|
|
--add-flags "--datadir $out/share/cataclysm-dda/"
|
|
fi
|
|
|
|
# Launch the wrapped program
|
|
replaceProgram() {
|
|
cp "$1" "''${1}.bk"
|
|
unlink "$1"
|
|
mv "''${1}.bk" "$1"
|
|
sed -i "$1" -e "s,${builtins.storeDir}/.\+\(/bin/cataclysm-tiles\),$out\1,"
|
|
}
|
|
for script in "$out/share/applications/cataclysm-dda.desktop" \
|
|
"$out/Applications/Cataclysm.app/Contents/MacOS/Cataclysm.sh"
|
|
do
|
|
if [ -e "$script" ]; then
|
|
replaceProgram "$script"
|
|
fi
|
|
done
|
|
'';
|
|
}
|