diff --git a/pkgs/applications/misc/hubstaff/default.nix b/pkgs/applications/misc/hubstaff/default.nix index f291ab898e3d..1bc22b6613d4 100644 --- a/pkgs/applications/misc/hubstaff/default.nix +++ b/pkgs/applications/misc/hubstaff/default.nix @@ -1,13 +1,12 @@ { lib, stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE , libXext , freetype, libXrender, fontconfig, libXft, libXinerama , libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3 -, curl }: +, curl, writeShellScript, common-updater-scripts }: let - - data = builtins.fromJSON (builtins.readFile ./revision.json); - - inherit (data) version url sha256; + url = "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.5.19-9e79d1da/Hubstaff-1.5.19-9e79d1da.sh"; + version = "1.5.19-9e79d1da"; + sha256 = "1l4sq8cblpl1kclkx5pgy0ldfmqa3n8bvdl5qml0n78r0lpk382j"; rpath = lib.makeLibraryPath [ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft @@ -56,6 +55,18 @@ stdenv.mkDerivation { ln -s $opt/data/resources $opt/x86_64/resources ''; + updateScript = writeShellScript "hubstaff-updater" '' + set -eu -o pipefail + + installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux) + + version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/') + + sha256=$(nix-prefetch-url "$installation_script_url") + + ${common-updater-scripts}/bin/update-source-version hubstaff "$version" "$sha256" "$installation_script_url" + ''; + meta = with lib; { description = "Time tracking software"; homepage = "https://hubstaff.com/"; diff --git a/pkgs/applications/misc/hubstaff/revision.json b/pkgs/applications/misc/hubstaff/revision.json deleted file mode 100644 index 9b0ffe67f0cd..000000000000 --- a/pkgs/applications/misc/hubstaff/revision.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "url": "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/1.5.15-28673d1c/Hubstaff-1.5.15-28673d1c.sh", - "version": "1.5.15-28673d1c", - "sha256": "0ging41l3a3sdj6bggh913h71gqmb8l3rplp4civpgclnfzv7fg2" -} diff --git a/pkgs/applications/misc/hubstaff/update.sh b/pkgs/applications/misc/hubstaff/update.sh deleted file mode 100755 index c4c1caf55db4..000000000000 --- a/pkgs/applications/misc/hubstaff/update.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p nix-prefetch-git curl - -SCRIPT_DIR=$(dirname "$(readlink -f "$BASH_SOURCE")") - -installation_script_url=$(curl --fail --head --location --silent --output /dev/null --write-out %{url_effective} https://app.hubstaff.com/download/linux) - -version=$(echo "$installation_script_url" | sed -r 's/^https:\/\/hubstaff\-production\.s3\.amazonaws\.com\/downloads\/HubstaffClient\/Builds\/Release\/([^\/]+)\/Hubstaff.+$/\1/') - -sha256=$(nix-prefetch-url "$installation_script_url") - -cat < $SCRIPT_DIR/revision.json -{ - "url": "$installation_script_url", - "version": "$version", - "sha256": "$sha256" -} -EOT