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
6 changed files
with
212 additions
and
0 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 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 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,26 @@ | ||
{ audioQuality, drl-unwrapped, fetchzip, lib }: let | ||
pname = "drl-${audioQuality}-audio"; | ||
inherit (drl-unwrapped) version; | ||
rev = builtins.replaceStrings ["."] ["_"] version; | ||
shortVersion = lib.concatStrings (builtins.filter (x: builtins.match "[0-9]+" x != null) (builtins.splitVersion version)); | ||
passthru = { inherit audioQuality; }; | ||
fetchtgz = fetchzip.override { withUnzip = false; }; | ||
in if audioQuality == "hq" then fetchtgz { | ||
inherit pname version passthru; | ||
url = "https://github.com/chaosforgeorg/doomrl/releases/download/${rev}/drl-linux-${shortVersion}.tar.gz"; | ||
postFetch = '' | ||
shopt -s extglob | ||
rm -r "$out"/!(mp3|wavhq) | ||
shopt -u extglob | ||
''; | ||
hash = "sha256-j1YzEAW40w+yBRT3MJz5IGe3gNvd4ede32SVhNAGjUc="; | ||
} else fetchtgz { | ||
inherit pname version passthru; | ||
url = "https://github.com/chaosforgeorg/doomrl/releases/download/${rev}/drl-linux-${shortVersion}-lq.tar.gz"; | ||
postFetch = '' | ||
shopt -s extglob | ||
rm -r "$out"/!(music|wav) | ||
shopt -u extglob | ||
''; | ||
hash = "sha256-GyOklqXecE6jhN2dZ6XIliLAZQob7gPgnkW484MQeiw="; | ||
} |
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,29 @@ | ||
{ stdenvNoCC, lib, drl-unwrapped, drl-audio, coreutils }: let | ||
wrongAudioSuffix = if drl-audio.audioQuality == "hq" then "" else "hq"; | ||
in stdenvNoCC.mkDerivation { | ||
pname = "drl-${drl-audio.audioQuality}"; | ||
inherit (drl-unwrapped) version; | ||
dontUnpack = true; | ||
unwrapped = drl-unwrapped; | ||
audio = drl-audio; | ||
inherit coreutils; | ||
installPhase = '' | ||
shopt -s extglob | ||
mkdir -p "$out"/bin "$out"/share/drl | ||
ln -s \ | ||
"$unwrapped"/share/drl/!(@(sound|music)${wrongAudioSuffix}.lua) \ | ||
"$out"/share/drl/ | ||
${lib.optionalString (drl-audio.audioQuality == "hq") '' | ||
for file in sound music; do | ||
mv "$out/share/drl/''${file}hq.lua" "$out/share/drl/$file.lua" | ||
done | ||
''} | ||
ln -s "$audio"/* "$out"/share/drl/ | ||
substituteAll ${./drl.sh} "$out"/bin/drl | ||
chmod +x "$out"/bin/drl | ||
shopt -u extglob | ||
''; | ||
meta = drl-unwrapped.meta // { | ||
mainProgram = "drl"; | ||
}; | ||
} |
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,22 @@ | ||
#!@shell@ | ||
set -e | ||
destDir="${XDG_DATA_HOME:-$HOME/.local/share}/drl" | ||
oldPath="$PATH" | ||
PATH="@coreutils@/bin" | ||
mkdir -p "$destDir" | ||
shopt -s extglob | ||
for file in @out@/share/drl/!(drl); do | ||
baseFile="${file##*/}" | ||
destFile="$destDir/$baseFile" | ||
if [[ ! -e "$destFile" ]]; then | ||
if [[ "$baseFile" == @(config.lua|colors.lua|screenshot|mortem|backup) ]]; then | ||
cp -Lr --no-preserve=all "$file" "$destFile" | ||
elif [[ ! -e "$destFile" || -L "$destFile" ]]; then | ||
ln -sf "$file" "$destDir" | ||
fi | ||
fi | ||
done | ||
shopt -u extglob | ||
PATH="$oldPath" | ||
cd "$destDir" | ||
exec -a drl @out@/share/drl/drl "$@" |
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,123 @@ | ||
{ stdenv, lib, fetchFromGitHub, writeText, lua5_1, SDL2, SDL2_image, SDL2_mixer, SDL2_ttf, ncurses, darwin, fpc, maintainers }: let | ||
libExt = if stdenv.isDarwin then "dylib" else "so"; | ||
version = "0.9.9.8a"; | ||
gitShortRev = "97f1c51"; | ||
rev = builtins.replaceStrings ["."] ["_"] version; | ||
shortVersion = lib.concatStrings (builtins.filter (x: builtins.match "[0-9]+" x != null) (builtins.splitVersion version)); | ||
src = fetchFromGitHub { | ||
owner = "chaosforgeorg"; | ||
repo = "doomrl"; | ||
inherit rev; | ||
hash = "sha256-5FwaBuMFrz5dOxhHsJZLmL/PkwhXgW5XpVKDWoiVuWk="; | ||
}; | ||
fpcvalkyrie = fetchFromGitHub { | ||
owner = "chaosforgeorg"; | ||
repo = "fpcvalkyrie"; | ||
rev = "0_9_0a"; | ||
hash = "sha256-R/FgbmT7pvw9Qn0a7uR/Hw4pEQ2mArZY6sqXShQWU1Q="; | ||
}; | ||
in stdenv.mkDerivation rec { | ||
pname = "drl-unwrapped"; | ||
inherit version gitShortRev; | ||
inherit src fpcvalkyrie; | ||
postUnpack = '' | ||
cp -r "$fpcvalkyrie" fpcvalkyrie | ||
chmod -R u+rwX fpcvalkyrie | ||
export FPCVALKYRIE_ROOT="$PWD/fpcvalkyrie/" | ||
''; | ||
nativeBuildInputs = [lua5_1 fpc]; | ||
buildInputs = [lua5_1 SDL2 SDL2_image SDL2_mixer SDL2_ttf ncurses]; | ||
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-unused-command-line-argument"; | ||
env.NIX_LDFLAGS = lib.optionalString stdenv.isDarwin (lib.concatMapStringsSep " " (f: "-F${f}/Library/Frameworks") (with darwin.apple_sdk.frameworks; [CoreFoundation Cocoa])); | ||
postPatch = '' | ||
sed -i ' | ||
/fpc_params =/ a\ | ||
"-dLUA_DYNAMIC", | ||
/macosx_version_min/ d | ||
/OSX_APP_BUNDLE/ d | ||
' makefile.lua | ||
substituteInPlace makefile.lua --replace-fail 'make.gitrevision()' "(function() | ||
local revision = '$gitShortRev' | ||
return { | ||
full = revision, | ||
working = tonumber(revision, 16), | ||
current = tonumber(revision, 16), | ||
mod = mod, | ||
} | ||
end)()" | ||
substituteInPlace "$FPCVALKYRIE_ROOT"/libs/vlualibrary.pas \ | ||
--replace-fail 'lua5.1.${libExt}' '${lib.getLib lua5_1}/lib/liblua.5.1.${libExt}' | ||
substituteInPlace "$FPCVALKYRIE_ROOT"/libs/vsdl2library.pas \ | ||
--replace-fail '${if stdenv.isDarwin then "SDL2.framework/SDL2" else "libSDL2-2.0.so.0"}' '${lib.getLib SDL2}/lib/libSDL2.${libExt}' \ | ||
--replace-fail '{$linklib SDLmain}' '{.$linklib SDL2main}' \ | ||
--replace-fail '{$linkframework SDL}' '{$linklib SDL2}' \ | ||
--replace-fail '{$PASCALMAINNAME SDL_main}' '{.$PASCALMAINNAME SDL_main}' | ||
substituteInPlace "$FPCVALKYRIE_ROOT"/libs/vsdl2imagelibrary.pas \ | ||
--replace-fail '${if stdenv.isDarwin then "SDL2_image.framework/SDL_image" else "libSDL2_image-2.0.so.0"}' '${lib.getLib SDL2_image}/lib/libSDL2_image.${libExt}' | ||
substituteInPlace "$FPCVALKYRIE_ROOT"/libs/vsdl2mixerlibrary.pas \ | ||
--replace-fail '${if stdenv.isDarwin then "SDL2_mixer.framework/SDL2_mixer" else "libSDL2_mixer-2.0.so.0"}' '${lib.getLib SDL2_mixer}/lib/libSDL2_mixer.${libExt}' | ||
substituteInPlace "$FPCVALKYRIE_ROOT"/libs/vsdl2ttflibrary.pas \ | ||
--replace-fail '${if stdenv.isDarwin then "SDL2_ttf.framework/SDL2_ttf" else "libSDL2_ttf-2.0.so.0"}' '${lib.getLib SDL2_ttf}/lib/libSDL2_ttf.${libExt}' | ||
'' + lib.optionalString stdenv.isDarwin '' | ||
sed -E -i ' | ||
/glExtLoader/ { | ||
/GetSymbolExt\s*:=/ s/glExtLoader/GetSymbol/ | ||
/GetSymbolExt\s*:=/! d | ||
} | ||
' "$FPCVALKYRIE_ROOT"/libs/vgl3library.pas | ||
''; | ||
configurePhase = '' | ||
runHook preConfigure | ||
cp ${writeText "config.lua" '' | ||
OS = "${if stdenv.isDarwin then "MACOSX" else "LINUX"}" | ||
''} config.lua | ||
runHook postConfigure | ||
''; | ||
buildPhase = '' | ||
runHook preBuild | ||
mkdir tmp | ||
lua makefile.lua | ||
ls -al bin | ||
runHook postBuild | ||
''; | ||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p "$out"/share/drl | ||
cp bin/drl "$out"/share/drl/drl | ||
for file in \ | ||
backup \ | ||
mortem \ | ||
screenshot \ | ||
modules \ | ||
config.lua \ | ||
colors.lua \ | ||
sound.lua \ | ||
soundhq.lua \ | ||
music.lua \ | ||
musichq.lua \ | ||
manual.txt \ | ||
version.txt \ | ||
version_api.txt \ | ||
drl.wad \ | ||
core.wad \ | ||
; do | ||
cp -r bin/"$file" "$out"/share/drl/"$file" | ||
done | ||
runHook postInstall | ||
''; | ||
meta = { | ||
description = "Roguelike game based on the FPS Doom"; | ||
longDescription = '' | ||
DRL (D**m, the Roguelike) is a fast and furious coffee-break Roguelike game, that is heavily inspired by the popular FPS game Doom by ID Software. | ||
''; | ||
homepage = "https://drl.chaosforge.org/"; | ||
licenses = with lib.licenses; [ | ||
# Code | ||
gpl2Only | ||
# Artwork | ||
# Music (according to <https://simonvolpert.com/drla/>) | ||
cc-by-sa-40 | ||
]; | ||
maintainers = [maintainers.Rhys-T]; | ||
}; | ||
} |