From 8395d7a4d390dad584ebc3f31c14c67f71e9c591 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Tue, 24 May 2022 13:06:19 +0200 Subject: [PATCH 01/13] libreoffice: add update-script for darwin --- .../office/libreoffice/darwin.nix | 51 ------------- .../office/libreoffice/darwin/darwin.nix | 73 +++++++++++++++++++ .../office/libreoffice/darwin/update-test.nix | 41 +++++++++++ .../libreoffice/darwin/update-utils.nix | 45 ++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 160 insertions(+), 52 deletions(-) delete mode 100644 pkgs/applications/office/libreoffice/darwin.nix create mode 100644 pkgs/applications/office/libreoffice/darwin/darwin.nix create mode 100644 pkgs/applications/office/libreoffice/darwin/update-test.nix create mode 100644 pkgs/applications/office/libreoffice/darwin/update-utils.nix diff --git a/pkgs/applications/office/libreoffice/darwin.nix b/pkgs/applications/office/libreoffice/darwin.nix deleted file mode 100644 index 765cbcd43024..000000000000 --- a/pkgs/applications/office/libreoffice/darwin.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ stdenv -, lib -, fetchurl -, undmg -}: - -let - appName = "LibreOffice.app"; - version = "7.2.5"; - dist = { - aarch64-darwin = { - arch = "aarch64"; - sha256 = "bdbcb9a98211f866ca089d440aebcd1d313aa99e8ab4104aae4e65ea3cee74ca"; - }; - - x86_64-darwin = { - arch = "x86_64"; - sha256 = "0b7ef18ed08341ac6c15339fe9a161ad17f6b469009d987cfc7d50c628d12a4e"; - }; - }."${stdenv.hostPlatform.system}"; -in -stdenv.mkDerivation { - inherit version; - pname = "libreoffice"; - src = fetchurl { - url = "https://download.documentfoundation.org/libreoffice/stable/${version}/mac/${dist.arch}/LibreOffice_${version}_MacOS_${dist.arch}.dmg"; - inherit (dist) sha256; - }; - - nativeBuildInputs = [ undmg ]; - sourceRoot = "${appName}"; - dontPatch = true; - dontConfigure = true; - dontBuild = true; - - installPhase = '' - runHook preInstallPhase - mkdir -p $out/{Applications/${appName},bin} - cp -R . $out/Applications/${appName} - ln -s $out/Applications/${appName}/Contents/MacOS/soffice $out/bin - runHook postInstallPhase - ''; - - meta = with lib; { - description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; - homepage = "https://libreoffice.org/"; - license = licenses.lgpl3; - maintainers = with maintainers; [ tricktron ]; - platforms = [ "aarch64-darwin" "x86_64-darwin" ]; - }; -} diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix new file mode 100644 index 000000000000..7b2f89cf0a5c --- /dev/null +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -0,0 +1,73 @@ +{ stdenv +, lib +, fetchurl +, undmg +, writeScript +}: + +let + appName = "LibreOffice.app"; + version = "7.2.5"; + baseUrl = "https://download.documentfoundation.org/libreoffice/stable"; + dist = { + aarch64-darwin = rec { + arch = "aarch64"; + archSuffix = arch; + url = "${baseUrl}/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; + sha256 = "bdbcb9a98211f866ca089d440aebcd1d313aa99e8ab4104aae4e65ea3cee74ca"; + }; + + x86_64-darwin = rec { + arch = "x86_64"; + archSuffix = "x86-64"; + url = "${baseUrl}/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; + sha256 = "0b7ef18ed08341ac6c15339fe9a161ad17f6b469009d987cfc7d50c628d12a4e"; + }; + }; +in +stdenv.mkDerivation rec { + inherit version; + pname = "libreoffice"; + src = fetchurl { + inherit (dist."${stdenv.hostPlatform.system}") url sha256; + }; + + nativeBuildInputs = [ undmg ]; + sourceRoot = "${appName}"; + dontPatch = true; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + runHook preInstallPhase + mkdir -p $out/{Applications/${appName},bin} + cp -R . $out/Applications/${appName} + ln -s $out/Applications/${appName}/Contents/MacOS/soffice $out/bin + runHook postInstallPhase + ''; + + passthru.updateScript = + let + inherit (import ./update-utils.nix { inherit lib; }) getLatestStableVersion getSha256 nullHash; + newVersion = getLatestStableVersion; + in + writeScript "update-libreoffice.sh" + '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p common-updater-scripts + set -o errexit + set -o nounset + set -o pipefail + update-source-version libreoffice ${newVersion} ${getSha256 dist."aarch64-darwin".url version newVersion} --system=aarch64-darwin + update-source-version libreoffice 0 ${nullHash} --system=x86_64-darwin + update-source-version libreoffice ${newVersion} ${getSha256 dist."x86_64-darwin".url version newVersion} --system=x86_64-darwin + ''; + + meta = with lib; { + description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; + homepage = "https://libreoffice.org/"; + license = licenses.lgpl3; + maintainers = with maintainers; [ tricktron ]; + platforms = [ "aarch64-darwin" "x86_64-darwin" ]; + }; +} diff --git a/pkgs/applications/office/libreoffice/darwin/update-test.nix b/pkgs/applications/office/libreoffice/darwin/update-test.nix new file mode 100644 index 000000000000..eeffec39830c --- /dev/null +++ b/pkgs/applications/office/libreoffice/darwin/update-test.nix @@ -0,0 +1,41 @@ +{ pkgs ? import {}, nixt }: +let + inherit (import ./update-utils.nix { inherit (pkgs) lib; }) + extractLatestVersionFromHtml + extractSha256FromHtml; +in +nixt.mkSuite "LibreOffice Updater" +{ + "should extract latest stable version from html" = let + latestVersionHtmlMock = + '' + + + + Index of /libreoffice/stable + + + +

Index of /libreoffice/stable

+ + + + + + +
 NameLast modifiedSizeMetadata

 Parent Directory  -  
 7.2.7/10-Mar-2022 11:12 -  
 7.3.3/12-May-2022 10:06 -  
 7.2.6/05-May-2022 07:57 -  

+
Apache Server at download.documentfoundation.org Port 80
+
MirrorBrain powered by Apache
+ + ''; + + actual = extractLatestVersionFromHtml latestVersionHtmlMock; + + in "7.3.3" == actual; + + "should extract sha256 from html" = let + sha256Html = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863 LibreOffice_7.3.3_MacOS_aarch64.dmg\n"; + actual = extractSha256FromHtml sha256Html; + in "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863" == actual; +} diff --git a/pkgs/applications/office/libreoffice/darwin/update-utils.nix b/pkgs/applications/office/libreoffice/darwin/update-utils.nix new file mode 100644 index 000000000000..fb4a7b0e7b20 --- /dev/null +++ b/pkgs/applications/office/libreoffice/darwin/update-utils.nix @@ -0,0 +1,45 @@ +{ lib }: +let +# extractLatestVersionFromHtml :: String -> String + extractLatestVersionFromHtml = htmlString: + let + majorMinorPatchGroup = "([0-9]+\\.[0-9]+\\.[0-9]+)"; + splittedVersions = builtins.split "href=\"${majorMinorPatchGroup}" htmlString; + stableVersions = builtins.concatLists (builtins.filter (e: builtins.isList e) splittedVersions); + in + if stableVersions == [] + then abort "Failed to extract versions from html." + else lib.last (builtins.sort builtins.lessThan stableVersions); + +# getHtml :: String -> String + getHtml = url: + builtins.readFile (builtins.fetchurl url); + +# getLatestStableVersion :: String + getLatestStableVersion = + extractLatestVersionFromHtml (getHtml "https://download.documentfoundation.org/libreoffice/stable/"); + +# extractSha256FromHtml :: String -> String + extractSha256FromHtml = htmlString: + let + sha256 = (builtins.match ".*([0-9a-fA-F]{64}).*" htmlString); + in + if sha256 == [] + then abort "Failed to extract sha256 from html." + else builtins.head sha256; + +# getSha256 :: String -> String + getSha256 = dmgUrl: oldVersion: newVersion: + extractSha256FromHtml (getHtml (getSha256Url dmgUrl oldVersion newVersion)); + +# getSha256Url :: String -> String -> String -> String + getSha256Url = dmgUrl: oldVersion: newVersion: + (builtins.replaceStrings [ oldVersion ] [ newVersion ] dmgUrl) + ".sha256"; + +# nullHash :: String + nullHash = "0000000000000000000000000000000000000000000000000000000000000000"; +in +{ + inherit extractLatestVersionFromHtml getHtml getLatestStableVersion + extractSha256FromHtml getSha256 getSha256Url nullHash; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9d16d3298d1f..194229f944c1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27773,7 +27773,7 @@ with pkgs; }; libreoffice = if stdenv.isDarwin - then callPackage ../applications/office/libreoffice/darwin.nix {} + then callPackage ../applications/office/libreoffice/darwin/darwin.nix {} else hiPrio libreoffice-still; libreoffice-unwrapped = (hiPrio libreoffice-still).libreoffice; From 9f80b6d8fe87eccd39e7018512de6998c2765551 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Wed, 25 May 2022 16:10:10 +0200 Subject: [PATCH 02/13] libreoffice: refactor and document version reset workaround --- .../office/libreoffice/darwin/darwin.nix | 30 +++++---- .../office/libreoffice/darwin/update-test.nix | 66 ++++++++++--------- .../libreoffice/darwin/update-utils.nix | 43 +++++++----- 3 files changed, 81 insertions(+), 58 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix index 7b2f89cf0a5c..9ac615486ab5 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -48,20 +48,28 @@ stdenv.mkDerivation rec { passthru.updateScript = let - inherit (import ./update-utils.nix { inherit lib; }) getLatestStableVersion getSha256 nullHash; + inherit (import ./update-utils.nix { inherit lib; }) + getLatestStableVersion + getSha256 + nullHash; newVersion = getLatestStableVersion; + newAarch64Sha256 = getSha256 dist."aarch64-darwin".url version newVersion; + newX86_64Sha256 = getSha256 dist."x86_64-darwin".url version newVersion; in writeScript "update-libreoffice.sh" - '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p common-updater-scripts - set -o errexit - set -o nounset - set -o pipefail - update-source-version libreoffice ${newVersion} ${getSha256 dist."aarch64-darwin".url version newVersion} --system=aarch64-darwin - update-source-version libreoffice 0 ${nullHash} --system=x86_64-darwin - update-source-version libreoffice ${newVersion} ${getSha256 dist."x86_64-darwin".url version newVersion} --system=x86_64-darwin - ''; + '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p common-updater-scripts + set -o errexit + set -o nounset + set -o pipefail + + # reset version first so that both platforms are always updated and in sync + update-source-version libreoffice 0 ${nullHash} --system=aarch64-darwin + update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --system=aarch64-darwin + update-source-version libreoffice 0 ${nullHash} --system=x86_64-darwin + update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --system=x86_64-darwin + ''; meta = with lib; { description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; diff --git a/pkgs/applications/office/libreoffice/darwin/update-test.nix b/pkgs/applications/office/libreoffice/darwin/update-test.nix index eeffec39830c..d77992263f3f 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-test.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-test.nix @@ -1,4 +1,6 @@ -{ pkgs ? import {}, nixt }: +# run the tests with nixt -v + +{ pkgs ? import { }, nixt }: let inherit (import ./update-utils.nix { inherit (pkgs) lib; }) extractLatestVersionFromHtml @@ -6,36 +8,40 @@ let in nixt.mkSuite "LibreOffice Updater" { - "should extract latest stable version from html" = let - latestVersionHtmlMock = - '' - - - - Index of /libreoffice/stable - - - -

Index of /libreoffice/stable

- - - - - - -
 NameLast modifiedSizeMetadata

 Parent Directory  -  
 7.2.7/10-Mar-2022 11:12 -  
 7.3.3/12-May-2022 10:06 -  
 7.2.6/05-May-2022 07:57 -  

-
Apache Server at download.documentfoundation.org Port 80
-
MirrorBrain powered by Apache
- - ''; + "should extract latest stable version from html" = + let + latestVersionHtmlMock = + '' + + + + Index of /libreoffice/stable + + + +

Index of /libreoffice/stable

+ + + + + + +
 NameLast modifiedSizeMetadata

 Parent Directory  -  
 7.2.7/10-Mar-2022 11:12 -  
 7.3.3/12-May-2022 10:06 -  
 7.2.6/05-May-2022 07:57 -  

+
Apache Server at download.documentfoundation.org Port 80
+
MirrorBrain powered by Apache
+ + ''; - actual = extractLatestVersionFromHtml latestVersionHtmlMock; + actual = extractLatestVersionFromHtml latestVersionHtmlMock; - in "7.3.3" == actual; + in + "7.3.3" == actual; - "should extract sha256 from html" = let - sha256Html = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863 LibreOffice_7.3.3_MacOS_aarch64.dmg\n"; - actual = extractSha256FromHtml sha256Html; - in "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863" == actual; + "should extract sha256 from html" = + let + sha256Html = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863 LibreOffice_7.3.3_MacOS_aarch64.dmg\n"; + actual = extractSha256FromHtml sha256Html; + in + "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863" == actual; } diff --git a/pkgs/applications/office/libreoffice/darwin/update-utils.nix b/pkgs/applications/office/libreoffice/darwin/update-utils.nix index fb4a7b0e7b20..71d8417e6747 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-utils.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-utils.nix @@ -1,45 +1,54 @@ { lib }: let -# extractLatestVersionFromHtml :: String -> String + # extractLatestVersionFromHtml :: String -> String extractLatestVersionFromHtml = htmlString: let majorMinorPatchGroup = "([0-9]+\\.[0-9]+\\.[0-9]+)"; splittedVersions = builtins.split "href=\"${majorMinorPatchGroup}" htmlString; - stableVersions = builtins.concatLists (builtins.filter (e: builtins.isList e) splittedVersions); + stableVersions = builtins.concatLists + (builtins.filter (e: builtins.isList e) + splittedVersions); in - if stableVersions == [] - then abort "Failed to extract versions from html." - else lib.last (builtins.sort builtins.lessThan stableVersions); + if stableVersions == [ ] + then abort "Failed to extract versions from html." + else lib.last (builtins.sort builtins.lessThan stableVersions); -# getHtml :: String -> String + # getHtml :: String -> String getHtml = url: builtins.readFile (builtins.fetchurl url); -# getLatestStableVersion :: String + # getLatestStableVersion :: String getLatestStableVersion = - extractLatestVersionFromHtml (getHtml "https://download.documentfoundation.org/libreoffice/stable/"); + extractLatestVersionFromHtml + (getHtml "https://download.documentfoundation.org/libreoffice/stable/"); -# extractSha256FromHtml :: String -> String + # extractSha256FromHtml :: String -> String extractSha256FromHtml = htmlString: let sha256 = (builtins.match ".*([0-9a-fA-F]{64}).*" htmlString); in - if sha256 == [] - then abort "Failed to extract sha256 from html." - else builtins.head sha256; + if sha256 == [ ] + then abort "Failed to extract sha256 from html." + else builtins.head sha256; -# getSha256 :: String -> String + # getSha256 :: String -> String getSha256 = dmgUrl: oldVersion: newVersion: extractSha256FromHtml (getHtml (getSha256Url dmgUrl oldVersion newVersion)); -# getSha256Url :: String -> String -> String -> String + # getSha256Url :: String -> String -> String -> String getSha256Url = dmgUrl: oldVersion: newVersion: (builtins.replaceStrings [ oldVersion ] [ newVersion ] dmgUrl) + ".sha256"; -# nullHash :: String + # nullHash :: String nullHash = "0000000000000000000000000000000000000000000000000000000000000000"; in { - inherit extractLatestVersionFromHtml getHtml getLatestStableVersion - extractSha256FromHtml getSha256 getSha256Url nullHash; + inherit + extractLatestVersionFromHtml + getHtml + getLatestStableVersion + extractSha256FromHtml + getSha256 + getSha256Url + nullHash; } From ed52a4493459ee51f9e8d0bf31b707b5a8598693 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Wed, 25 May 2022 17:47:56 +0200 Subject: [PATCH 03/13] libreoffice: general darwin improvements - throw error if platform is not supported - fix wrong pre/postInstallPhase hook -> pre/postInstall - switch to stdenvNoCC because we don't build anything - run all phases by default - wrap binary using `open -na $out/Applications/${appName} --args "$@"` --- .../office/libreoffice/darwin/darwin.nix | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix index 9ac615486ab5..73602d3e317b 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -1,4 +1,4 @@ -{ stdenv +{ stdenvNoCC , lib , fetchurl , undmg @@ -7,6 +7,7 @@ let appName = "LibreOffice.app"; + scriptName = "soffice"; version = "7.2.5"; baseUrl = "https://download.documentfoundation.org/libreoffice/stable"; dist = { @@ -25,25 +26,27 @@ let }; }; in -stdenv.mkDerivation rec { +stdenvNoCC.mkDerivation { inherit version; pname = "libreoffice"; src = fetchurl { - inherit (dist."${stdenv.hostPlatform.system}") url sha256; + inherit (dist.${stdenvNoCC.hostPlatform.system} or + (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}")) url sha256; }; nativeBuildInputs = [ undmg ]; sourceRoot = "${appName}"; - dontPatch = true; - dontConfigure = true; - dontBuild = true; installPhase = '' - runHook preInstallPhase + runHook preInstall mkdir -p $out/{Applications/${appName},bin} cp -R . $out/Applications/${appName} - ln -s $out/Applications/${appName}/Contents/MacOS/soffice $out/bin - runHook postInstallPhase + cat > $out/bin/${scriptName} << EOF + #!${stdenvNoCC.shell} + open -na $out/Applications/${appName} --args "$@" + EOF + chmod +x $out/bin/${scriptName} + runHook postInstall ''; passthru.updateScript = @@ -63,7 +66,7 @@ stdenv.mkDerivation rec { set -o errexit set -o nounset set -o pipefail - + # reset version first so that both platforms are always updated and in sync update-source-version libreoffice 0 ${nullHash} --system=aarch64-darwin update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --system=aarch64-darwin From ccfd4255bb77f3769345e6e1799eb2f00168e05a Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Wed, 25 May 2022 20:11:06 +0200 Subject: [PATCH 04/13] libreoffice: 7.2.5 -> 7.3.3 --- pkgs/applications/office/libreoffice/darwin/darwin.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix index 73602d3e317b..73eaf081c3a6 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -8,21 +8,21 @@ let appName = "LibreOffice.app"; scriptName = "soffice"; - version = "7.2.5"; + version = "7.3.3"; baseUrl = "https://download.documentfoundation.org/libreoffice/stable"; dist = { aarch64-darwin = rec { arch = "aarch64"; archSuffix = arch; url = "${baseUrl}/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; - sha256 = "bdbcb9a98211f866ca089d440aebcd1d313aa99e8ab4104aae4e65ea3cee74ca"; + sha256 = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863"; }; x86_64-darwin = rec { arch = "x86_64"; archSuffix = "x86-64"; url = "${baseUrl}/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; - sha256 = "0b7ef18ed08341ac6c15339fe9a161ad17f6b469009d987cfc7d50c628d12a4e"; + sha256 = "fb2f9bb90eee34a22af3a2bf2854ef5b76098302b3c41d13d4f543f0d72b994f"; }; }; in From d679ccc970b7847a3bf216a1456c99ec5a52f774 Mon Sep 17 00:00:00 2001 From: tricktron Date: Wed, 25 May 2022 21:21:25 +0200 Subject: [PATCH 05/13] libreoffice: apply suggestions from code review Co-authored-by: Sandro --- pkgs/applications/office/libreoffice/darwin/darwin.nix | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix index 73eaf081c3a6..1bb1b0fc5580 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -9,19 +9,18 @@ let appName = "LibreOffice.app"; scriptName = "soffice"; version = "7.3.3"; - baseUrl = "https://download.documentfoundation.org/libreoffice/stable"; dist = { aarch64-darwin = rec { arch = "aarch64"; archSuffix = arch; - url = "${baseUrl}/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; + url = "https://download.documentfoundation.org/libreoffice/stable/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; sha256 = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863"; }; x86_64-darwin = rec { arch = "x86_64"; archSuffix = "x86-64"; - url = "${baseUrl}/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; + url = "https://download.documentfoundation.org/libreoffice/stable/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; sha256 = "fb2f9bb90eee34a22af3a2bf2854ef5b76098302b3c41d13d4f543f0d72b994f"; }; }; @@ -63,9 +62,7 @@ stdenvNoCC.mkDerivation { '' #!/usr/bin/env nix-shell #!nix-shell -i bash -p common-updater-scripts - set -o errexit - set -o nounset - set -o pipefail + set -eou pipefail # reset version first so that both platforms are always updated and in sync update-source-version libreoffice 0 ${nullHash} --system=aarch64-darwin From 2fb0615a66d2d7bd4745aeec995645e7cb01411b Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Wed, 25 May 2022 21:35:11 +0200 Subject: [PATCH 06/13] libreoffice: add integration test and use `lib.fakeSha256` --- pkgs/applications/office/libreoffice/darwin/darwin.nix | 7 +++---- .../applications/office/libreoffice/darwin/update-test.nix | 5 ++++- .../office/libreoffice/darwin/update-utils.nix | 5 +---- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix index 1bb1b0fc5580..2228d6bbfe6f 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/darwin.nix @@ -52,8 +52,7 @@ stdenvNoCC.mkDerivation { let inherit (import ./update-utils.nix { inherit lib; }) getLatestStableVersion - getSha256 - nullHash; + getSha256; newVersion = getLatestStableVersion; newAarch64Sha256 = getSha256 dist."aarch64-darwin".url version newVersion; newX86_64Sha256 = getSha256 dist."x86_64-darwin".url version newVersion; @@ -65,9 +64,9 @@ stdenvNoCC.mkDerivation { set -eou pipefail # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice 0 ${nullHash} --system=aarch64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --system=aarch64-darwin update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --system=aarch64-darwin - update-source-version libreoffice 0 ${nullHash} --system=x86_64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --system=x86_64-darwin update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --system=x86_64-darwin ''; diff --git a/pkgs/applications/office/libreoffice/darwin/update-test.nix b/pkgs/applications/office/libreoffice/darwin/update-test.nix index d77992263f3f..994a923c556d 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-test.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-test.nix @@ -4,7 +4,8 @@ let inherit (import ./update-utils.nix { inherit (pkgs) lib; }) extractLatestVersionFromHtml - extractSha256FromHtml; + extractSha256FromHtml + getLatestStableVersion; in nixt.mkSuite "LibreOffice Updater" { @@ -38,6 +39,8 @@ nixt.mkSuite "LibreOffice Updater" in "7.3.3" == actual; + "should extract latest stable version from website" = (builtins.compareVersions getLatestStableVersion "7.3.3") >= 0; + "should extract sha256 from html" = let sha256Html = "50ed3deb8d9c987516e2687ebb865bca15486c69da79f1b6d74381e43f2ec863 LibreOffice_7.3.3_MacOS_aarch64.dmg\n"; diff --git a/pkgs/applications/office/libreoffice/darwin/update-utils.nix b/pkgs/applications/office/libreoffice/darwin/update-utils.nix index 71d8417e6747..766e858e33e2 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-utils.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-utils.nix @@ -39,8 +39,6 @@ let getSha256Url = dmgUrl: oldVersion: newVersion: (builtins.replaceStrings [ oldVersion ] [ newVersion ] dmgUrl) + ".sha256"; - # nullHash :: String - nullHash = "0000000000000000000000000000000000000000000000000000000000000000"; in { inherit @@ -49,6 +47,5 @@ in getLatestStableVersion extractSha256FromHtml getSha256 - getSha256Url - nullHash; + getSha256Url; } From d4dd3f5f7e2f1df1e57f933504f942404e8eca9c Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Fri, 27 May 2022 10:46:00 +0200 Subject: [PATCH 07/13] libreoffice: move darwin to separate libreoffice-darwin package The linux and darwin derivations are completely different. Therefore, it makes more sense to treat them as two separate, independent derivations. --- .../office/libreoffice/darwin/{darwin.nix => default.nix} | 0 pkgs/top-level/all-packages.nix | 5 ++--- 2 files changed, 2 insertions(+), 3 deletions(-) rename pkgs/applications/office/libreoffice/darwin/{darwin.nix => default.nix} (100%) diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/default.nix similarity index 100% rename from pkgs/applications/office/libreoffice/darwin/darwin.nix rename to pkgs/applications/office/libreoffice/darwin/default.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 194229f944c1..efd142af7e7a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27772,9 +27772,8 @@ with pkgs; boost = boost175; }; - libreoffice = if stdenv.isDarwin - then callPackage ../applications/office/libreoffice/darwin/darwin.nix {} - else hiPrio libreoffice-still; + libreoffice-darwin = callPackage ../applications/office/libreoffice/darwin {}; + libreoffice = hiPrio libreoffice-still; libreoffice-unwrapped = (hiPrio libreoffice-still).libreoffice; libreoffice-args = { From b9a5485aa5ebe0547de52f04603831d74f00e1f8 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Fri, 27 May 2022 14:37:33 +0200 Subject: [PATCH 08/13] Revert "libreoffice: move darwin to separate libreoffice-darwin package" Introducing a new name for each complex darwin derivation does not scale. This reverts commit b207ef980751b2dfe2f222fbd7dbc854f9bd90bf. --- .../office/libreoffice/darwin/{default.nix => darwin.nix} | 0 pkgs/top-level/all-packages.nix | 5 +++-- 2 files changed, 3 insertions(+), 2 deletions(-) rename pkgs/applications/office/libreoffice/darwin/{default.nix => darwin.nix} (100%) diff --git a/pkgs/applications/office/libreoffice/darwin/default.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix similarity index 100% rename from pkgs/applications/office/libreoffice/darwin/default.nix rename to pkgs/applications/office/libreoffice/darwin/darwin.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index efd142af7e7a..194229f944c1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27772,8 +27772,9 @@ with pkgs; boost = boost175; }; - libreoffice-darwin = callPackage ../applications/office/libreoffice/darwin {}; - libreoffice = hiPrio libreoffice-still; + libreoffice = if stdenv.isDarwin + then callPackage ../applications/office/libreoffice/darwin/darwin.nix {} + else hiPrio libreoffice-still; libreoffice-unwrapped = (hiPrio libreoffice-still).libreoffice; libreoffice-args = { From 8315cf274bf02124dbdea8106d6cd7ccefbd9484 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Fri, 27 May 2022 15:48:59 +0200 Subject: [PATCH 09/13] libreoffice: add darwin to meta platforms and extract to common.nix As a result, the darwin derivations will show up on https://search.nixos.org/packages. --- .../office/libreoffice/common.nix | 10 +++++++++ .../darwin/{darwin.nix => default.nix} | 21 ++++++++----------- .../office/libreoffice/default.nix | 8 +------ pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) create mode 100644 pkgs/applications/office/libreoffice/common.nix rename pkgs/applications/office/libreoffice/darwin/{darwin.nix => default.nix} (84%) diff --git a/pkgs/applications/office/libreoffice/common.nix b/pkgs/applications/office/libreoffice/common.nix new file mode 100644 index 000000000000..b1c547feb366 --- /dev/null +++ b/pkgs/applications/office/libreoffice/common.nix @@ -0,0 +1,10 @@ +{ lib }: +{ + meta = with lib; { + description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; + homepage = "https://libreoffice.org/"; + license = licenses.lgpl3; + maintainers = with maintainers; [ raskin tricktron ]; + platforms = platforms.linux ++ [ "x86_64-darwin" "aarch64-darwin" ]; + }; +} diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/default.nix similarity index 84% rename from pkgs/applications/office/libreoffice/darwin/darwin.nix rename to pkgs/applications/office/libreoffice/darwin/default.nix index 2228d6bbfe6f..47b702cc29d4 100644 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ b/pkgs/applications/office/libreoffice/darwin/default.nix @@ -3,12 +3,15 @@ , fetchurl , undmg , writeScript +, callPackage }: let appName = "LibreOffice.app"; scriptName = "soffice"; version = "7.3.3"; + common = import ../common.nix { inherit lib; }; + dist = { aarch64-darwin = rec { arch = "aarch64"; @@ -27,6 +30,7 @@ let in stdenvNoCC.mkDerivation { inherit version; + inherit (import ../common.nix { inherit lib; }) meta; pname = "libreoffice"; src = fetchurl { inherit (dist.${stdenvNoCC.hostPlatform.system} or @@ -56,6 +60,7 @@ stdenvNoCC.mkDerivation { 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; in writeScript "update-libreoffice.sh" '' @@ -64,17 +69,9 @@ stdenvNoCC.mkDerivation { set -eou pipefail # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice 0 ${lib.fakeSha256} --system=aarch64-darwin - update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --system=aarch64-darwin - update-source-version libreoffice 0 ${lib.fakeSha256} --system=x86_64-darwin - update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --system=x86_64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --file ${currentFile} --system=aarch64-darwin + update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --file ${currentFile} --system=aarch64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --file ${currentFile} --system=x86_64-darwin + update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --file ${currentFile} --system=x86_64-darwin ''; - - meta = with lib; { - description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; - homepage = "https://libreoffice.org/"; - license = licenses.lgpl3; - maintainers = with maintainers; [ tricktron ]; - platforms = [ "aarch64-darwin" "x86_64-darwin" ]; - }; } diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 74a4c156b830..2e781936c7ac 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -581,11 +581,5 @@ in requiredSystemFeatures = [ "big-parallel" ]; - meta = with lib; { - description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; - homepage = "https://libreoffice.org/"; - license = licenses.lgpl3; - maintainers = with maintainers; [ raskin ]; - platforms = platforms.linux; - }; + inherit (import ../common.nix { inherit lib; }) meta; }).overrideAttrs ((importVariant "override.nix") (args // { inherit kdeIntegration; })) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 194229f944c1..43e9efa515b4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27773,7 +27773,7 @@ with pkgs; }; libreoffice = if stdenv.isDarwin - then callPackage ../applications/office/libreoffice/darwin/darwin.nix {} + then callPackage ../applications/office/libreoffice/darwin { } else hiPrio libreoffice-still; libreoffice-unwrapped = (hiPrio libreoffice-still).libreoffice; From 56ce01eca397ece27f5073f7eee3e637e90b4d2a Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Fri, 27 May 2022 16:55:53 +0200 Subject: [PATCH 10/13] libreoffice: pass explicit file to update-source-version function and fix import typo --- pkgs/applications/office/libreoffice/darwin/default.nix | 8 ++++---- pkgs/applications/office/libreoffice/default.nix | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/office/libreoffice/darwin/default.nix b/pkgs/applications/office/libreoffice/darwin/default.nix index 47b702cc29d4..d1a47d467911 100644 --- a/pkgs/applications/office/libreoffice/darwin/default.nix +++ b/pkgs/applications/office/libreoffice/darwin/default.nix @@ -69,9 +69,9 @@ stdenvNoCC.mkDerivation { set -eou pipefail # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice 0 ${lib.fakeSha256} --file ${currentFile} --system=aarch64-darwin - update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --file ${currentFile} --system=aarch64-darwin - update-source-version libreoffice 0 ${lib.fakeSha256} --file ${currentFile} --system=x86_64-darwin - update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --file ${currentFile} --system=x86_64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --file=${currentFile} --system=aarch64-darwin + update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --file=${currentFile} --system=aarch64-darwin + update-source-version libreoffice 0 ${lib.fakeSha256} --file=${currentFile} --system=x86_64-darwin + update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --file=${currentFile} --system=x86_64-darwin ''; } diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 2e781936c7ac..978c2da26a78 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -581,5 +581,5 @@ in requiredSystemFeatures = [ "big-parallel" ]; - inherit (import ../common.nix { inherit lib; }) meta; + inherit (import ./common.nix { inherit lib; }) meta; }).overrideAttrs ((importVariant "override.nix") (args // { inherit kdeIntegration; })) From fe949d64ef417ec254fea7d2ae022b1f78f4ad1e Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Sat, 28 May 2022 17:40:04 +0200 Subject: [PATCH 11/13] libreoffice: rename libreoffice -> libreoffice-bin --- pkgs/applications/office/libreoffice/common.nix | 10 ---------- .../office/libreoffice/darwin/default.nix | 17 +++++++++++------ .../applications/office/libreoffice/default.nix | 8 +++++++- pkgs/top-level/all-packages.nix | 7 ++++--- 4 files changed, 22 insertions(+), 20 deletions(-) delete mode 100644 pkgs/applications/office/libreoffice/common.nix diff --git a/pkgs/applications/office/libreoffice/common.nix b/pkgs/applications/office/libreoffice/common.nix deleted file mode 100644 index b1c547feb366..000000000000 --- a/pkgs/applications/office/libreoffice/common.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ lib }: -{ - meta = with lib; { - description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; - homepage = "https://libreoffice.org/"; - license = licenses.lgpl3; - maintainers = with maintainers; [ raskin tricktron ]; - platforms = platforms.linux ++ [ "x86_64-darwin" "aarch64-darwin" ]; - }; -} diff --git a/pkgs/applications/office/libreoffice/darwin/default.nix b/pkgs/applications/office/libreoffice/darwin/default.nix index d1a47d467911..5fdf2544ef46 100644 --- a/pkgs/applications/office/libreoffice/darwin/default.nix +++ b/pkgs/applications/office/libreoffice/darwin/default.nix @@ -10,7 +10,6 @@ let appName = "LibreOffice.app"; scriptName = "soffice"; version = "7.3.3"; - common = import ../common.nix { inherit lib; }; dist = { aarch64-darwin = rec { @@ -30,7 +29,6 @@ let in stdenvNoCC.mkDerivation { inherit version; - inherit (import ../common.nix { inherit lib; }) meta; pname = "libreoffice"; src = fetchurl { inherit (dist.${stdenvNoCC.hostPlatform.system} or @@ -69,9 +67,16 @@ stdenvNoCC.mkDerivation { set -eou pipefail # reset version first so that both platforms are always updated and in sync - update-source-version libreoffice 0 ${lib.fakeSha256} --file=${currentFile} --system=aarch64-darwin - update-source-version libreoffice ${newVersion} ${newAarch64Sha256} --file=${currentFile} --system=aarch64-darwin - update-source-version libreoffice 0 ${lib.fakeSha256} --file=${currentFile} --system=x86_64-darwin - update-source-version libreoffice ${newVersion} ${newX86_64Sha256} --file=${currentFile} --system=x86_64-darwin + 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 ''; + meta = with lib; { + description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; + homepage = "https://libreoffice.org/"; + license = licenses.lgpl3; + maintainers = with maintainers; [ tricktron ]; + platforms = [ "x86_64-darwin" "aarch64-darwin" ]; + }; } diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 978c2da26a78..74a4c156b830 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -581,5 +581,11 @@ in requiredSystemFeatures = [ "big-parallel" ]; - inherit (import ./common.nix { inherit lib; }) meta; + meta = with lib; { + description = "Comprehensive, professional-quality productivity suite, a variant of openoffice.org"; + homepage = "https://libreoffice.org/"; + license = licenses.lgpl3; + maintainers = with maintainers; [ raskin ]; + platforms = platforms.linux; + }; }).overrideAttrs ((importVariant "override.nix") (args // { inherit kdeIntegration; })) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 43e9efa515b4..2eac3b4d6eed 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -27772,9 +27772,10 @@ with pkgs; boost = boost175; }; - libreoffice = if stdenv.isDarwin - then callPackage ../applications/office/libreoffice/darwin { } - else hiPrio libreoffice-still; + libreoffice-bin = callPackage ../applications/office/libreoffice/darwin { }; + + libreoffice = hiPrio libreoffice-still; + libreoffice-unwrapped = (hiPrio libreoffice-still).libreoffice; libreoffice-args = { From 4c23cbcc15034e043ab522815af020254c2472da Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Mon, 30 May 2022 17:20:00 +0200 Subject: [PATCH 12/13] libreoffice: add impure functions comment --- pkgs/applications/office/libreoffice/darwin/update-utils.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/applications/office/libreoffice/darwin/update-utils.nix b/pkgs/applications/office/libreoffice/darwin/update-utils.nix index 766e858e33e2..ed8b24ac87de 100644 --- a/pkgs/applications/office/libreoffice/darwin/update-utils.nix +++ b/pkgs/applications/office/libreoffice/darwin/update-utils.nix @@ -1,3 +1,4 @@ +# Impure functions, for passthru.updateScript only { lib }: let # extractLatestVersionFromHtml :: String -> String From d7ccd36aa0a38c9c6d8d30e3afd5fae7505e2cdd Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Tue, 31 May 2022 10:03:40 +0200 Subject: [PATCH 13/13] libreoffice: run the update-script's side-effect at runtime instead of eval time --- .../office/libreoffice/darwin/default.nix | 22 +++++++++---------- .../libreoffice/darwin/update-utils.nix | 1 - .../office/libreoffice/darwin/update.nix | 18 +++++++++++++++ 3 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 pkgs/applications/office/libreoffice/darwin/update.nix 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; +}