about summary refs log tree commit diff
path: root/pkgs/applications/office/morgen
diff options
context:
space:
mode:
authorjustanotherariel <ariel@ebersberger.io>2023-12-20 02:16:47 +0100
committerjustanotherariel <ariel@ebersberger.io>2024-01-05 18:13:48 +0100
commitc74ab161ff32b3922d5893553a7dc5867597379a (patch)
treeddcab28107f9932c9ae7de9c2ff844d1752701c3 /pkgs/applications/office/morgen
parent852831a9cd6780efd34676cc70f374bc934bdfc8 (diff)
morgen: add updateScript and mainProgram
Diffstat (limited to 'pkgs/applications/office/morgen')
-rw-r--r--pkgs/applications/office/morgen/default.nix9
-rwxr-xr-xpkgs/applications/office/morgen/update.sh26
2 files changed, 32 insertions, 3 deletions
diff --git a/pkgs/applications/office/morgen/default.nix b/pkgs/applications/office/morgen/default.nix
index f2bcd3b6a975a..7bb816a3f48eb 100644
--- a/pkgs/applications/office/morgen/default.nix
+++ b/pkgs/applications/office/morgen/default.nix
@@ -6,8 +6,8 @@ stdenv.mkDerivation rec {
   version = "3.0.1";
 
   src = fetchurl {
-    url = "https://download.todesktop.com/210203cqcj00tw1/morgen-${version}.deb";
-    sha256 = "sha256-lj+V5mntZzED2ZS62Uwlt/vTXwSuwzXeuEw8y/bA6og=";
+    url = "https://dl.todesktop.com/210203cqcj00tw1/versions/${version}/linux/deb";
+    hash = "sha256-lj+V5mntZzED2ZS62Uwlt/vTXwSuwzXeuEw8y/bA6og=";
   };
 
   nativeBuildInputs = [
@@ -46,12 +46,15 @@ stdenv.mkDerivation rec {
     runHook postInstall
   '';
 
+  passthru.updateScript = ./update.sh;
+
   meta = with lib; {
     description = "All-in-one Calendars, Tasks and Scheduler";
     homepage = "https://morgen.so/download";
+    mainProgram = "morgen";
     sourceProvenance = with sourceTypes; [ binaryNativeCode ];
     license = licenses.unfree;
-    maintainers = with maintainers; [ wolfangaukang ];
+    maintainers = with maintainers; [ justanotherariel wolfangaukang ];
     platforms = [ "x86_64-linux" ];
   };
 }
diff --git a/pkgs/applications/office/morgen/update.sh b/pkgs/applications/office/morgen/update.sh
new file mode 100755
index 0000000000000..e12f86a04bbca
--- /dev/null
+++ b/pkgs/applications/office/morgen/update.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl jq common-updater-scripts
+
+set -euo pipefail
+
+# URL to check for the latest version
+latestUrl="https://dl.todesktop.com/210203cqcj00tw1/linux/deb/x64"
+
+# Fetch the latest version information
+latestInfo=$(curl -sI -X GET $latestUrl | grep -oP 'morgen-\K\d+(\.\d+)*(?=[^\d])')
+
+if [[ -z "$latestInfo" ]]; then
+    echo "Could not find the latest version number."
+    exit 1
+fi
+
+# Extract the version number
+latestVersion=$(echo "$latestInfo" | head -n 1)
+
+echo "Latest version of Morgen is $latestVersion"
+
+# Update the package definition
+update-source-version morgen "$latestVersion"
+
+# Fetch and update the hash
+nix-prefetch-url --unpack "https://dl.todesktop.com/210203cqcj00tw1/versions/${latestVersion}/linux/deb"