sublime3: Add updateScript
This commit is contained in:
parent
0105058698
commit
a5cdac3d7c
@ -1,8 +1,9 @@
|
||||
{buildVersion, x32sha256, x64sha256}:
|
||||
{buildVersion, x32sha256, x64sha256, dev ? false}:
|
||||
|
||||
{ fetchurl, stdenv, glib, xorg, cairo, gtk2, gtk3, pango, makeWrapper, wrapGAppsHook, openssl, bzip2, runtimeShell,
|
||||
pkexecPath ? "/run/wrappers/bin/pkexec", libredirect,
|
||||
gksuSupport ? false, gksu, unzip, zip, bash}:
|
||||
gksuSupport ? false, gksu, unzip, zip, bash,
|
||||
writeScript, common-updater-scripts, curl, gnugrep}:
|
||||
|
||||
assert gksuSupport -> gksu != null;
|
||||
|
||||
@ -26,7 +27,7 @@ in let
|
||||
|
||||
# package with just the binaries
|
||||
sublime = stdenv.mkDerivation {
|
||||
name = "sublimetext3-${buildVersion}-bin";
|
||||
name = "sublimetext3-bin-${buildVersion}";
|
||||
src =
|
||||
fetchurl {
|
||||
name = "sublimetext-${buildVersion}.tar.bz2";
|
||||
@ -127,6 +128,22 @@ in stdenv.mkDerivation (rec {
|
||||
ln -s $sublime/Icon/256x256/ $out/share/icons
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeScript "sublime3-update-script" ''
|
||||
#!${stdenv.shell}
|
||||
set -o errexit
|
||||
PATH=${stdenv.lib.makeBinPath [ common-updater-scripts curl gnugrep ]}
|
||||
|
||||
latestVersion=$(curl https://www.sublimetext.com/3${stdenv.lib.optionalString dev "dev"} | grep -Po '(?<=<p class="latest"><i>Version:</i> Build )([0-9]+)')
|
||||
|
||||
for platform in ${stdenv.lib.concatStringsSep " " meta.platforms}; do
|
||||
package=sublime3${stdenv.lib.optionalString dev "-dev"}
|
||||
# The script will not perform an update when the version attribute is up to date from previous platform run
|
||||
# We need to clear it before each run
|
||||
update-source-version ''${package}.sublime 0 0000000000000000000000000000000000000000000000000000000000000000 --file=pkgs/applications/editors/sublime/3/packages.nix --version-key=buildVersion --system=$platform
|
||||
update-source-version ''${package}.sublime $latestVersion --file=pkgs/applications/editors/sublime/3/packages.nix --version-key=buildVersion --system=$platform
|
||||
done
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Sophisticated text editor for code, markup and prose";
|
||||
homepage = https://www.sublimetext.com/;
|
||||
|
@ -6,6 +6,7 @@ in
|
||||
rec {
|
||||
sublime3-dev = common {
|
||||
buildVersion = "3184";
|
||||
dev = true;
|
||||
x32sha256 = "1b6f1fid75g5z247dbnyyj276lrlv99scrdk1vvfcr6vyws77vzr";
|
||||
x64sha256 = "03127jhfjr17ai96p3axh5b5940fds8jcw6vkid8y6dmvd2dpylz";
|
||||
} {};
|
||||
|
Loading…
Reference in New Issue
Block a user