summary refs log tree commit diff
diff options
context:
space:
mode:
authorSerhii Khoma <srghma@gmail.com>2021-06-18 14:59:10 +0300
committerGitHub <noreply@github.com>2021-06-18 13:59:10 +0200
commit3b6c3bee9174dfe56fd0e586449457467abe7116 (patch)
treeb6da2fe9e580c196d743fea120d352aaeb7ca563
parent9f0979714e6735bb331ba258e31f678a98304d19 (diff)
downloadnixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.tar
nixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.tar.gz
nixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.tar.bz2
nixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.tar.lz
nixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.tar.xz
nixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.tar.zst
nixpkgs-3b6c3bee9174dfe56fd0e586449457467abe7116.zip
hubstaff: 1.5.2-bead991b -> 1.5.19-9e79d1da (#126855)
* hubstaff: 1.5.15 -> 1.5.19-9e79d1da

* hubstaff: use updateScript for automatic updates

* Apply suggestions from code review

* Delete revision.json

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
-rw-r--r--pkgs/applications/misc/hubstaff/default.nix21
-rw-r--r--pkgs/applications/misc/hubstaff/revision.json5
-rwxr-xr-xpkgs/applications/misc/hubstaff/update.sh18
3 files changed, 16 insertions, 28 deletions
diff --git a/pkgs/applications/misc/hubstaff/default.nix b/pkgs/applications/misc/hubstaff/default.nix
index f291ab898e3..1bc22b6613d 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 9b0ffe67f0c..00000000000
--- 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 c4c1caf55db..00000000000
--- 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 <<EOT > $SCRIPT_DIR/revision.json
-{
-  "url": "$installation_script_url",
-  "version": "$version",
-  "sha256": "$sha256"
-}
-EOT