generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
283 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
stdenvNoCC, lib, | ||
lix-game, | ||
useHighResTitleScreen ? false, requireFile, | ||
convertImagesToTrueColor ? stdenvNoCC.isDarwin, imagemagick | ||
}: let | ||
# <https://github.com/SimonN/LixD/issues/128> | ||
highResTitleScreen = requireFile { | ||
name = "243207799-937e6266-bad8-46f5-baef-ddef5378009c.png"; | ||
url = "https://github.com/SimonN/LixD/issues/128#issuecomment-1575734721"; | ||
hash = "sha256-BopSCjgHq6sBVeTZcIL49tABM3bDe6YYPjIt68i7I9s="; | ||
}; | ||
in stdenvNoCC.mkDerivation { | ||
pname = "${lix-game.pname}-assets"; | ||
inherit (lix-game) version src; | ||
nativeBuildInputs = lib.optionals convertImagesToTrueColor [imagemagick]; | ||
${if useHighResTitleScreen then "highResTitleScreen" else null} = highResTitleScreen; | ||
postPatch = '' | ||
rm -r data/desktop | ||
'' + lib.optionalString useHighResTitleScreen '' | ||
cp -f "$highResTitleScreen" data/images/mainmenubg.png | ||
'' + lib.optionalString convertImagesToTrueColor '' | ||
echo 'Converting all game images to PNG32 to work around <https://github.com/SimonN/LixD/issues/431>...' | ||
find images/ data/images/ -name \*.png -exec magick {} PNG32:{} \; | ||
echo 'Done.' | ||
''; | ||
installPhase = '' | ||
mkdir -p "$out" | ||
cp -r data images levels "$out"/ | ||
''; | ||
meta = { | ||
description = "${lix-game.meta.description} (game asset files)"; | ||
inherit (lix-game.meta) homepage; | ||
license = with lib.licenses; [ | ||
cc0 | ||
bitstreamVera # data/fonts/djvusans.ttf | ||
]; | ||
}; | ||
passthru = { | ||
inherit useHighResTitleScreen convertImagesToTrueColor; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
{ | ||
stdenvNoCC, lib, buildDubPackage, | ||
fetchFromGitHub, | ||
allegro5, enet, | ||
makeBinaryWrapper, desktopToDarwinBundle, writeDarwinBundle, | ||
lix-game-assets, lix-game-music, includeMusic ? true, | ||
useHighResTitleScreen ? lix-game-assets.useHighResTitleScreen, | ||
convertImagesToTrueColor ? lix-game-assets.convertImagesToTrueColor, | ||
disableNativeImageLoader ? !convertImagesToTrueColor && stdenvNoCC.isDarwin | ||
}: with import ./lib.nix { inherit stdenvNoCC lib enet; }; let | ||
allegro5' = if disableNativeImageLoader then allegro5.overrideAttrs (old: { | ||
cmakeFlags = (old.cmakeFlags or []) ++ ["-DWANT_NATIVE_IMAGE_LOADER=off"]; | ||
}) else allegro5; | ||
desktopToDarwinBundleWithCustomPlistEntries = plistExtra: desktopToDarwinBundle.overrideAttrs (old: { | ||
propagatedBuildInputs = map (x: if x.name == "write-darwin-bundle" then writeDarwinBundle.override { | ||
lib = lib // { | ||
generators = lib.generators // { | ||
toPlist = options: data: lib.generators.toPlist options (data // plistExtra); | ||
}; | ||
}; | ||
} else x) old.propagatedBuildInputs; | ||
}); | ||
lix-game = buildDubPackage { | ||
pname = "lix-game"; | ||
version = "0.10.26"; | ||
src = fetchFromGitHub { | ||
owner = "SimonN"; | ||
repo = "LixD"; | ||
rev = "v${lix-game.version}"; | ||
hash = "sha256-cDR/7GFkFPRH8HK5k4q3PMon2tW+eyCUL9qgNBtI2rU="; | ||
}; | ||
dubLock = ./dub-lock.json; | ||
dubBuildType = "releaseXDG"; | ||
nativeBuildInputs = lib.optionals stdenvNoCC.isDarwin [makeBinaryWrapper (desktopToDarwinBundleWithCustomPlistEntries { | ||
CFBundleIdentifier = "com.lixgame.Lix"; | ||
LSApplicationCategoryType = "public.app-category.puzzle-games"; | ||
NSHighResolutionCapable = true; | ||
})]; | ||
buildInputs = [allegro5' enet]; | ||
postPatch = '' | ||
sed -E -i ' | ||
/libs-posix/ a\ | ||
"allegro", "allegro_audio", "allegro_font", | ||
/libs-posix/,/\]/ s/-5//g | ||
' dub.json | ||
substituteInPlace src/file/filename/fhs.d --replace-fail 'enum customReadOnlyDir = "";' "enum customReadOnlyDir = \"$out/share\";" | ||
''; | ||
|
||
# Ugly hack: I need to patch a few dub dependencies, and they're copied in by configurePhase, so I have to do it here. | ||
# Patch #1: Make derelict-enet use the full path to enet, so we don't have to handle it in a wrapper. | ||
# Patch #2 (Darwin only): Include the changes from <https://github.com/SiegeLord/DAllegro5/issues/56> to make the .app bundle work. | ||
postConfigure = patchEnetBindings + lib.optionalString stdenvNoCC.isDarwin '' | ||
for dir in "$DUB_HOME"/packages/allegro/*/allegro/; do | ||
patch -d "$dir" -p1 < ${./patches/DAllegro/fix-56-run-from-darwin-app-bundle.patch} | ||
done | ||
''; | ||
|
||
lixAssets = lix-game-assets.override { inherit lix-game useHighResTitleScreen convertImagesToTrueColor; }; | ||
${if includeMusic then "lixMusic" else null} = lix-game-music.override { inherit lix-game; }; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p \ | ||
"$out"/bin \ | ||
"$out"/share/applications \ | ||
"$out"/share/metainfo \ | ||
"$out"/share/icons/hicolor/scalable/apps \ | ||
"$out"/share/man/man6 \ | ||
"$out"/share/doc \ | ||
"$out"/share/licenses/lix | ||
cp bin/lix "$out"/bin | ||
'' + lib.optionalString stdenvNoCC.isDarwin ( | ||
let | ||
libsToWrapWith = [ | ||
allegro5' # The allegro5 derivation doesn't currently run fixDarwinDylibNames. | ||
# Even if I use install_name_tool to put the full library paths into the executable, | ||
# the libraries still don't have each other's full paths and can't load each other. | ||
]; | ||
in '' | ||
wrapProgram "$out"/bin/lix --prefix DYLD_LIBRARY_PATH ':' ${lib.escapeShellArg (lib.makeLibraryPath libsToWrapWith)} | ||
'' | ||
) + (if includeMusic then '' | ||
mkdir -p "$out"/share/lix | ||
ln -s "$lixAssets"/* "$out"/share/lix/ | ||
ln -s "$lixMusic" "$out"/share/lix/music | ||
'' else '' | ||
ln -s "$lixAssets" "$out"/share/lix | ||
'') + '' | ||
cp -r doc "$out"/share/doc/lix | ||
mv "$out"/share/doc/lix/lix.6 "$out"/share/man/man6 | ||
mv "$out"/share/doc/lix/copying.txt "$out"/share/licenses/lix/COPYING | ||
cp data/desktop/com.lixgame.Lix.desktop "$out"/share/applications | ||
cp data/desktop/com.lixgame.Lix.metainfo.xml "$out"/share/metainfo | ||
cp data/images/lix_logo.svg "$out"/share/icons/hicolor/scalable/apps/com.lixgame.Lix.svg | ||
runHook postInstall | ||
''; | ||
meta = { | ||
description = "Lemmings-like game with puzzles, editor, multiplayer"; | ||
longDescription = '' | ||
Lix is a puzzle game inspired by Lemmings (DMA Design, 1991). Lix is free and open source. | ||
Assign skills to guide the lix through over 850 singleplayer puzzles. Design your own levels with the included editor. | ||
Attack and defend in real-time multiplayer for 2 to 8 players: Who can save the most lix? | ||
''; | ||
homepage = "https://www.lixgame.com/"; | ||
changelog = "https://github.com/SimonN/LixD/releases/tag/v${lix-game.version}"; | ||
license = lib.unique ( | ||
[lib.licenses.cc0] ++ | ||
(lix-game-assets.meta.license or []) ++ | ||
lib.optionals includeMusic (lib.toList (lix-game-music.license or [])) | ||
); | ||
mainProgram = "lix"; | ||
}; | ||
}; | ||
in lix-game |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"dependencies": { | ||
"allegro": { | ||
"version": "4.0.6+5.2.0", | ||
"sha256": "1czaiyapxvrrn1lkw35jizi484f48b76hsvm9f4rdq2m05bxpwwx" | ||
}, | ||
"bolts": { | ||
"version": "1.3.1", | ||
"sha256": "1klz02r13r3yq8vcw1gkv39r02vpnv7wlhhb5kkjnybc3s86w1q8" | ||
}, | ||
"derelict-enet": { | ||
"version": "4.2.0", | ||
"sha256": "1z6whs21hbazdqmnqc19a6f8dcy7lyrc0ivs0jrfqga88ixc8z9c" | ||
}, | ||
"derelict-util": { | ||
"version": "3.0.0-beta.2", | ||
"sha256": "0xj4gbmdpmkmkhpq64s17gbmbkifaivkfks6sirk5j82vgl7rvh4" | ||
}, | ||
"enumap": { | ||
"version": "0.4.2", | ||
"sha256": "01pg310ngb7zb1n9a1wgkm1gsprrkpyh9lhz9qigxvz9706p9vwq" | ||
}, | ||
"optional": { | ||
"version": "1.3.0", | ||
"sha256": "18c061sm1sxyscmdj0zpy6sd4mcrmj4pmqb6xsxvy63k0y68j4lc" | ||
}, | ||
"sdlang-d": { | ||
"version": "0.10.6", | ||
"sha256": "1qm3ba7xgml570ajbdz72bvrgmq9yhw2ird5pr54c4zz0cywl2r4" | ||
}, | ||
"taggedalgebraic": { | ||
"version": "0.11.22", | ||
"sha256": "1kc39sdnk2ybhrwxiwyw1mqcw0qzjr0vr54yvyp3gkkaad373k4r" | ||
}, | ||
"unit-threaded": { | ||
"version": "0.7.55", | ||
"sha256": "07wk8jj4dlhddc8k42mn8s5wdkgvqrl9kqdbh8yblyx52igmq5hy" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ stdenvNoCC, lib, enet }: { | ||
patchEnetBindings = let libExtension = if stdenvNoCC.isDarwin then "dylib" else "so"; in '' | ||
for file in "$DUB_HOME"/packages/derelict-enet/*/derelict-enet/source/derelict/enet/enet.d; do | ||
substituteInPlace "$file" --replace-fail '"libenet.${libExtension}"' '"${lib.getLib enet}/lib/libenet.${libExtension}"' | ||
done | ||
''; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{fetchzip, lib, lix-game}: fetchzip { | ||
pname = "${lix-game.pname}-music"; | ||
# Upstream Last-Modified: 2023-04-15 ("Sat, 15 Apr 2023 20:58:14 GMT") | ||
# Snapshot taken on: 2024-09-02 | ||
version = "0-unstable-2023-04-15"; | ||
# Upstream archive isn't versioned - use web.archive.org to make sure the hash doesn't change on us | ||
url = "https://web.archive.org/web/20240902001641/https://www.lixgame.com/dow/lix-music.zip"; | ||
hash = "sha256-JIXQ+P3AQW7EWVDHlR+Z4SWAxVAFO3d3KeB3QBGx+YQ="; | ||
meta = { | ||
description = "${lix-game.meta.description} (music files)"; | ||
inherit (lix-game) homepage; | ||
license = with lib.licenses; [ | ||
cc0 | ||
cc-by-40 # rubix | ||
]; | ||
}; | ||
} |
32 changes: 32 additions & 0 deletions
32
pkgs/lix-game/patches/DAllegro/fix-56-run-from-darwin-app-bundle.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
diff --git a/allegro5/system.d b/allegro5/system.d | ||
index 85b92d7..a14a33a 100644 | ||
--- a/allegro5/system.d | ||
+++ b/allegro5/system.d | ||
@@ -13,6 +13,8 @@ extern (C) void rt_moduleTlsDtor(); | ||
|
||
int al_run_allegro(scope int delegate() user_main) | ||
{ | ||
+ __gshared int delegate() user_main2; | ||
+ user_main2 = user_main; | ||
extern(C) static int main_runner(int argc, char** argv) | ||
{ | ||
version(OSX) | ||
@@ -21,7 +23,7 @@ int al_run_allegro(scope int delegate() user_main) | ||
rt_moduleTlsCtor(); | ||
} | ||
|
||
- auto main_ret = (*cast(int delegate()*)argv[0])(); | ||
+ auto main_ret = user_main2(); | ||
|
||
version(OSX) | ||
{ | ||
@@ -32,8 +34,7 @@ int al_run_allegro(scope int delegate() user_main) | ||
return main_ret; | ||
} | ||
|
||
- char* fake_arg = cast(char*)&user_main; | ||
- return al_run_main(0, &fake_arg, &main_runner); | ||
+ return al_run_main(0, null, &main_runner); | ||
} | ||
|
||
nothrow @nogc extern (C) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{stdenvNoCC, lib, buildDubPackage, enet, lix-game}: with import ./lib.nix { inherit stdenvNoCC lib enet; }; buildDubPackage { | ||
pname = "${lix-game.pname}-server"; | ||
inherit (lix-game) version src; | ||
# dubLock = ./dub-lock.server.json; | ||
dubLock = let fullLock = lib.importJSON ./dub-lock.json; in { | ||
dependencies = lib.filterAttrs (name: info: builtins.elem name ["derelict-enet" "derelict-util"]) fullLock.dependencies; | ||
}; | ||
buildInputs = [enet]; | ||
postConfigure = patchEnetBindings { inherit stdenvNoCC lib enet; }; | ||
sourceRoot = "source/src/server"; | ||
postUnpack = ''chmod u+w "$sourceRoot"/../..''; # need to be able to create 'bin' directory there | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p "$out"/bin | ||
cp ../../bin/lixserv "$out"/bin | ||
runHook postInstall | ||
''; | ||
meta = { | ||
inherit (lix-game.meta) homepage; | ||
license = lib.licenses.cc0; | ||
mainProgram = "lixserv"; | ||
}; | ||
} |