about summary refs log tree commit diff
path: root/pkgs/by-name/hd
diff options
context:
space:
mode:
authorGabriel Fontes <hi@m7.rs>2024-05-18 14:48:46 -0300
committerGabriel Fontes <hi@m7.rs>2024-05-20 12:18:27 -0300
commit6022f4ef5740a0e8fc9de4514592942a9ee42064 (patch)
tree770ecb4f42d133fd23f5f40c6cf81041177faf0b /pkgs/by-name/hd
parent3e08211f7980959cee900f091f01d6fc1a7d2be3 (diff)
hdos: init at 8
Fixes #307154
Diffstat (limited to 'pkgs/by-name/hd')
-rw-r--r--pkgs/by-name/hd/hdos/package.nix64
-rwxr-xr-xpkgs/by-name/hd/hdos/update.sh7
2 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/by-name/hd/hdos/package.nix b/pkgs/by-name/hd/hdos/package.nix
new file mode 100644
index 0000000000000..9737d12d273d4
--- /dev/null
+++ b/pkgs/by-name/hd/hdos/package.nix
@@ -0,0 +1,64 @@
+{
+  lib,
+  stdenvNoCC,
+  fetchurl,
+  makeWrapper,
+  # TODO: for jre 17+, we'll need a workaroud:
+  # https://gitlab.com/hdos/issues/-/issues/2004
+  openjdk11,
+  makeDesktopItem,
+  copyDesktopItems,
+  libGL,
+}:
+stdenvNoCC.mkDerivation (finalAttrs: {
+  pname = "hdos";
+  version = "8";
+
+  src = fetchurl {
+    url = "https://cdn.hdos.dev/launcher/v${finalAttrs.version}/hdos-launcher.jar";
+    hash = "sha256-00ddeR+ov6Tjrn+pscXoao4C0ek/iP9Hdlgq946pL8A=";
+  };
+
+  dontUnpack = true;
+
+  desktop = makeDesktopItem {
+    name = "HDOS";
+    type = "Application";
+    exec = "hdos";
+    icon = fetchurl {
+      url = "https://raw.githubusercontent.com/flathub/dev.hdos.HDOS/8e17cbecb06548fde2c023032e89ddf30befeabc/dev.hdos.HDOS.png";
+      hash = "sha256-pqLNJ0g7GCPotgEPfw2ZZOqapaCRAsJxB09INp6Y6gM=";
+    };
+    comment = "HDOS is a client for Old School RuneScape that emulates the era of 2008-2011 RuneScape HD";
+    desktopName = "HDOS";
+    genericName = "Oldschool Runescape";
+    categories = [ "Game" ];
+  };
+
+  nativeBuildInputs = [
+    makeWrapper
+    copyDesktopItems
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    makeWrapper ${lib.getExe openjdk11} $out/bin/hdos \
+      --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \
+      --add-flags "-jar $src"
+    runHook postInstall
+  '';
+
+  desktopItems = [ finalAttrs.desktop ];
+
+  passthru.updateScript = ./update.sh;
+
+  meta = {
+    description = "High Detail Old School Runescape Client";
+    homepage = "https://hdos.dev";
+    changelog = "https://hdos.dev/changelog";
+    sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
+    license = lib.licenses.unfree;
+    platforms = openjdk11.meta.platforms;
+    maintainers = [ lib.maintainers.misterio77 ];
+  };
+})
diff --git a/pkgs/by-name/hd/hdos/update.sh b/pkgs/by-name/hd/hdos/update.sh
new file mode 100755
index 0000000000000..e2effc6d0d9e2
--- /dev/null
+++ b/pkgs/by-name/hd/hdos/update.sh
@@ -0,0 +1,7 @@
+#! /usr/bin/env nix-shell
+#! nix-shell -i bash -p common-updater-scripts findutils
+
+set -euo pipefail
+
+version="$(curl -s https://cdn.hdos.dev/client/getdown.txt | grep 'launcher.version = ' | cut -d '=' -f2 | xargs)"
+update-source-version hdos "$version"