diff options
author | Thibault Gagnaux <tgagnaux@gmail.com> | 2022-05-31 10:03:40 +0200 |
---|---|---|
committer | Thibault Gagnaux <tgagnaux@gmail.com> | 2022-05-31 21:54:41 +0200 |
commit | d7ccd36aa0a38c9c6d8d30e3afd5fae7505e2cdd (patch) | |
tree | a43b6fc85c312daa8cfe42aefe685e5751cb9a23 /pkgs/applications/office | |
parent | 4c23cbcc15034e043ab522815af020254c2472da (diff) |
libreoffice: run the update-script's side-effect at runtime instead of eval
time
Diffstat (limited to 'pkgs/applications/office')
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 5fdf2544ef465..ddfaf584021cb 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 ed8b24ac87de2..766e858e33e2c 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 0000000000000..b74cca802fcb1 --- /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; +} |