-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
2 changed files
with
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
lib, | ||
symlinkJoin, | ||
makeDesktopItem, | ||
iconConvTools, | ||
|
||
the-dark-mod-unwrapped, | ||
the-dark-mod-assets, | ||
writableDirWrapper, | ||
}: | ||
let | ||
runScript = writableDirWrapper rec { | ||
name = "the-dark-mod"; | ||
inherit (the-dark-mod-unwrapped) version; | ||
path = "\${XDG_DATA_HOME:-$HOME/.local/share}/darkmod"; | ||
|
||
links = [ { src = the-dark-mod-assets; } ]; | ||
|
||
postLink = '' | ||
# Log directory override - by default TDM puts the logs directly in PWD. | ||
# We don't want that. If the user does not already have a darkmod.ini, we | ||
# generate a default one with the correct log path | ||
rm darkmod.ini | ||
if [[ ! -e "${path}/darkmod.ini" ]]; then | ||
logDir="''${XDG_STATE_HOME:-$HOME/.local/state}/darkmod" | ||
mkdir -p "$logDir" | ||
printf "[Debug]\nLogFile=%s/Darkmod.log" "$logDir" > darkmod.ini | ||
fi | ||
''; | ||
|
||
run = '' | ||
${lib.getExe the-dark-mod-unwrapped} \ | ||
+set fs_basepath "${path}" \ | ||
+set fs_savepath "${path}" \ | ||
+set fs_modSavePath "${path}/fms" \ | ||
''; | ||
}; | ||
|
||
description = "Dark and moody stealth game inspired by the Thief series by Looking Glass Studios"; | ||
|
||
desktopItem = 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; | ||
}; | ||
in | ||
symlinkJoin { | ||
pname = "the-dark-mod"; | ||
inherit (the-dark-mod-unwrapped) version; | ||
|
||
paths = [ | ||
runScript | ||
desktopItem | ||
]; | ||
|
||
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; | ||
license = the-dark-mod-unwrapped.meta.license ++ the-dark-mod-assets.meta.license; | ||
mainProgram = "the-dark-mod"; | ||
}; | ||
} |
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,33 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p subversion common-updater-scripts | ||
|
||
attr=the-dark-mod | ||
svnUrl=https://svn.thedarkmod.com/publicsvn/darkmod_src/tags | ||
|
||
versions=$(svn list $svnUrl | rg "^\d+.\d+/\$" | tr -d '/') | ||
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; $attr.version" | tr -d '"') | ||
|
||
echo "Current TDM version: $currentVersion" | ||
for version in $versions; do | ||
[ "$version" = "$(printf '%s\n%s' "$version" "$currentVersion" | sort -V | head -n1)" ] && continue | ||
|
||
echo "New version found: $version"; | ||
rev=$(svn info $svnUrl/$version --show-item last-changed-revision) | ||
|
||
echo "Updating engine"; | ||
update-source-version "$attr-unwrapped" "$version" --rev="$rev" | ||
|
||
echo "Updating assets"; | ||
oldAssetsHash=$(nix-instantiate --eval --strict -A "the-dark-mod-assets.drvAttrs.outputHash" | tr -d '"') | ||
nix-build --no-out-link -A "the-dark-mod-assets" 2>&1 | tee assets.log | ||
newAssetsHash=$(grep -P --only-matching "got: +.+[:-]\K.+" assets.log) | ||
|
||
sed -i.cmp 's,$oldAssetsHash,$newAssetsHash,' pkgs/by-name/th/the-dark-mod-assets/package.nix | ||
|
||
echo "Update complete!"; | ||
|
||
exit 0 | ||
done | ||
|
||
echo "Already at latest version" | ||
|