summary refs log tree commit diff
path: root/pkgs/applications/editors/sublime
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2022-08-16 12:13:06 +0200
committerJan Tojnar <jtojnar@gmail.com>2022-08-29 21:28:19 +0200
commit75dc7411abe2bcfa72f0228e90b278e4da4497fb (patch)
treef098c14a240572436cca8b89456e5cb3f6ee8071 /pkgs/applications/editors/sublime
parent98584efa4b2562041e6937ae680a7a35f8f76224 (diff)
sublime4.updateScript: Pass versionFile path through arguments
That way, `maintainers/scripts/update.nix` will be able to turn
the path to relative and be able to update it even with `--argstr commit true`.
Diffstat (limited to 'pkgs/applications/editors/sublime')
-rw-r--r--pkgs/applications/editors/sublime/4/common.nix40
1 files changed, 22 insertions, 18 deletions
diff --git a/pkgs/applications/editors/sublime/4/common.nix b/pkgs/applications/editors/sublime/4/common.nix
index 0e510687a0689..0f2afb432e4cf 100644
--- a/pkgs/applications/editors/sublime/4/common.nix
+++ b/pkgs/applications/editors/sublime/4/common.nix
@@ -122,24 +122,28 @@ in stdenv.mkDerivation (rec {
   '';
 
   passthru = {
-    updateScript = writeShellScript "${packageAttribute}-update-script" ''
-      set -o errexit
-      PATH=${lib.makeBinPath [ common-updater-scripts curl ]}
-
-      latestVersion=$(curl -s "${versionUrl}")
-
-      if [[ "${buildVersion}" = "$latestVersion" ]]; then
-          echo "The new version same as the old version."
-          exit 0
-      fi
-
-      for platform in ${lib.escapeShellArgs meta.platforms}; do
-          # 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 "${packageAttribute}.${primaryBinary}" 0 "${lib.fakeSha256}" --file=${versionFile} --version-key=buildVersion --source-key="sources.$platform"
-          update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --file=${versionFile} --version-key=buildVersion --source-key="sources.$platform"
-      done
-    '';
+    updateScript =
+      let
+        script = writeShellScript "${packageAttribute}-update-script" ''
+          set -o errexit
+          PATH=${lib.makeBinPath [ common-updater-scripts curl ]}
+
+          versionFile=$1
+          latestVersion=$(curl -s "${versionUrl}")
+
+          if [[ "${buildVersion}" = "$latestVersion" ]]; then
+              echo "The new version same as the old version."
+              exit 0
+          fi
+
+          for platform in ${lib.escapeShellArgs meta.platforms}; do
+              # 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 "${packageAttribute}.${primaryBinary}" 0 "${lib.fakeSha256}" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform"
+              update-source-version "${packageAttribute}.${primaryBinary}" "$latestVersion" --file="$versionFile" --version-key=buildVersion --source-key="sources.$platform"
+          done
+        '';
+      in [ script versionFile ];
   };
 
   meta = with lib; {