Skip to content

Commit

Permalink
the-dark-mod: init at 2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
pluiedev committed Nov 18, 2024
1 parent 5ad4389 commit 9b849f4
Showing 1 changed file with 109 additions and 0 deletions.
109 changes: 109 additions & 0 deletions pkgs/by-name/th/the-dark-mod/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
lib,
symlinkJoin,
writeShellApplication,
makeDesktopItem,
iconConvTools,

addDriverRunpath,
libGL,
xorg,
alsa-lib,

the-dark-mod-unwrapped,
the-dark-mod-assets,
}:
let
libPath = lib.makeLibraryPath [
# GLFW
addDriverRunpath.driverLink
libGL
xorg.libX11
xorg.libXcursor
xorg.libXext
xorg.libXrandr
xorg.libXxf86vm

# OpenAL
alsa-lib
];

runScript = writeShellApplication {
name = "the-dark-mod";
runtimeInputs = [ xorg.lndir ];

text = ''
gameDir=''${XDG_DATA_HOME:-$HOME/.local/share}/darkmod
mkdir -p "$gameDir"
lndir -silent ${the-dark-mod-assets} "$gameDir"
# Log directory override - by default TDM puts the logs directly in PWD.
# We don't want that
logDir=''${XDG_STATE_HOME:-$HOME/.local/state}/darkmod
mkdir -p "$logDir"
rm "$gameDir/darkmod.ini"
cat >"$gameDir/darkmod.ini" <<EOF
[Debug]
LogFile=$logDir/Darkmod.log
EOF
export LD_LIBRARY_PATH=${libPath}:$LD_LIBRARY_PATH
# I don't know why openal-soft doesn't detect this by itself, but without
# this there is no audio :p
export ALSOFT_CONF=$gameDir/alsoft.ini
${lib.getExe the-dark-mod-unwrapped} \
+set fs_basepath "$gameDir" \
+set fs_savepath "$gameDir" \
+set fs_modSavePath "$gameDir/fms"
'';
};

description = "Dark and moody stealth game inspired by the Thief series by Looking Glass Studios";
in
symlinkJoin {
pname = "the-dark-mod";
inherit (the-dark-mod-unwrapped) version;

paths = [
runScript
(makeDesktopItem {
name = "the-dark-mod";
desktopName = "The Dark Mod";
comment = description;
icon = "the-dark-mod";
exec = "the-dark-mod";
categories = [
"Game"
"ActionGame"
"AdventureGame"
"RolePlaying"
];
keywords = [
"Stealth"
"Steampunk"
"Thief"
];
prefersNonDefaultGPU = true;
})
];

nativeBuildInputs = [ iconConvTools ];

postBuild = ''
icoFileToHiColorTheme ${the-dark-mod-assets}/darkmod.ico the-dark-mod $out
'';

meta = {
inherit (the-dark-mod-unwrapped.meta)
homepage
changelog
platforms
maintainers
;
inherit description;
licenses = the-dark-mod-unwrapped.meta.licenses ++ the-dark-mod-assets.meta.licenses;
mainProgram = "the-dark-mod";
};
}

0 comments on commit 9b849f4

Please sign in to comment.