diff options
| author | Thibault Gagnaux <tgagnaux@gmail.com> | 2022-05-31 10:03:40 +0200 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2022-06-01 08:43:30 +0000 |
| commit | 1f29859f4dd1f5079b966777ecd174ab715a13b6 (patch) | |
| tree | b3f61a57d14a11e7d27a41f2f9e1e4981756de3c | |
| parent | libreoffice: add impure functions comment (diff) | |
| download | nixpkgs-origin/backport-175160-to-release-22.05.tar.gz | |
libreoffice: run the update-script's side-effect at runtime instead of evalorigin/backport-175160-to-release-22.05
time
(cherry picked from commit d7ccd36aa0a38c9c6d8d30e3afd5fae7505e2cdd)
3 files changed, 28 insertions, 13 deletions
diff --git a/pkgs/applications/office/libreoffice/darwin/default.nix b/pkgs/applications/office/libreoffice/darwin/default.nix index 5fdf2544ef46..ddfaf584021c 100644 --- a/pkgs/applications/office/libreoffice/darwin/default.nix +++ b/pkgs/applications/office/libreoffice/darwin/default.nix @@ -52,26 +52,24 @@ stdenvNoCC.mkDerivation { passthru.updateScript = let - inherit (import ./update-utils.nix { inherit lib; }) - getLatestStableVersion - getSha256; - newVersion = getLatestStableVersion; - newAarch64Sha256 = getSha256 dist."aarch64-darwin".url version newVersion; - newX86_64Sha256 = getSha256 dist."x86_64-darwin".url version newVersion; - currentFile = builtins.toString ./default.nix; + defaultNixFile = builtins.toString ./default.nix; + updateNix = builtins.toString ./update.nix; + aarch64Url = dist."aarch64-darwin".url; + x86_64Url = dist."x86_64-darwin".url; in writeScript "update-libreoffice.sh" '' #!/usr/bin/env nix-shell - #!nix-shell -i bash -p common-updater-scripts + #!nix-shell -i bash --argstr aarch64Url ${aarch64Url} --argstr x86_64Url ${x86_64Url} --argstr version ${version} ${updateNix} set -eou pipefail # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice-bin 0 ${lib.fakeSha256} --file=${currentFile} --system=aarch64-darwin - update-source-version libreoffice-bin ${newVersion} ${newAarch64Sha256} --file=${currentFile} --system=aarch64-darwin - update-source-version libreoffice-bin 0 ${lib.fakeSha256} --file=${currentFile} --system=x86_64-darwin - update-source-version libreoffice-bin ${newVersion} ${newX86_64Sha256} --file=${currentFile} --system=x86_64-darwin + update-source-version libreoffice-bin 0 ${lib.fakeSha256} --file=${defaultNixFile} --system=aarch64-darwin + update-source-version libreoffice-bin $newVersion $newAarch64Sha256 --file=${defaultNixFile} --system=aarch64-darwin + update-source-version libreoffice-bin 0 ${lib.fakeSha256} --file=${defaultNixFile} --system=x86_64-darwin + update-source-version libreoffice-bin $newVersion $newX86_64Sha256 --file=${defaultNixFile} --system=x86_64-darwin ''; + meta = with lib; { description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; homepage = "https://libreoffice.org/"; diff --git a/pkgs/applications/office/libreoffice/darwin/update-utils.nix b/pkgs/applications/office/libreoffice/darwin/update-utils.nix index ed8b24ac87de..766e858e33e2 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-utils.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-utils.nix @@ -1,4 +1,3 @@ -# Impure functions, for passthru.updateScript only { lib }: let # extractLatestVersionFromHtml :: String -> String diff --git a/pkgs/applications/office/libreoffice/darwin/update.nix b/pkgs/applications/office/libreoffice/darwin/update.nix new file mode 100644 index 000000000000..b74cca802fcb --- /dev/null +++ b/pkgs/applications/office/libreoffice/darwin/update.nix @@ -0,0 +1,18 @@ +# Impure functions, for passthru.updateScript runtime only +{ aarch64Url +, x86_64Url +, version +, pkgs ? import ../../../../../default.nix { } +, +}: +let + inherit (import ./update-utils.nix { inherit (pkgs) lib; }) + getLatestStableVersion + getSha256; +in +pkgs.mkShell rec { + buildInputs = [ pkgs.common-updater-scripts ]; + newVersion = getLatestStableVersion; + newAarch64Sha256 = getSha256 aarch64Url version newVersion; + newX86_64Sha256 = getSha256 x86_64Url version newVersion; +} |
