From d4dd3f5f7e2f1df1e57f933504f942404e8eca9c Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Fri, 27 May 2022 10:46:00 +0200 Subject: 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 | 80 ---------------------- .../office/libreoffice/darwin/default.nix | 80 ++++++++++++++++++++++ 2 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 pkgs/applications/office/libreoffice/darwin/darwin.nix create mode 100644 pkgs/applications/office/libreoffice/darwin/default.nix (limited to 'pkgs/applications/office/libreoffice') diff --git a/pkgs/applications/office/libreoffice/darwin/darwin.nix b/pkgs/applications/office/libreoffice/darwin/darwin.nix deleted file mode 100644 index 2228d6bbfe6fd..0000000000000 --- a/pkgs/applications/office/libreoffice/darwin/darwin.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ stdenvNoCC -, lib -, fetchurl -, undmg -, writeScript -}: - -let - appName = "LibreOffice.app"; - scriptName = "soffice"; - version = "7.3.3"; - dist = { - aarch64-darwin = rec { - arch = "aarch64"; - archSuffix = arch; - 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 = "https://download.documentfoundation.org/libreoffice/stable/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; - sha256 = "fb2f9bb90eee34a22af3a2bf2854ef5b76098302b3c41d13d4f543f0d72b994f"; - }; - }; -in -stdenvNoCC.mkDerivation { - inherit version; - pname = "libreoffice"; - src = fetchurl { - inherit (dist.${stdenvNoCC.hostPlatform.system} or - (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}")) url sha256; - }; - - nativeBuildInputs = [ undmg ]; - sourceRoot = "${appName}"; - - installPhase = '' - runHook preInstall - mkdir -p $out/{Applications/${appName},bin} - cp -R . $out/Applications/${appName} - cat > $out/bin/${scriptName} << EOF - #!${stdenvNoCC.shell} - open -na $out/Applications/${appName} --args "$@" - EOF - chmod +x $out/bin/${scriptName} - runHook postInstall - ''; - - 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; - in - writeScript "update-libreoffice.sh" - '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p common-updater-scripts - 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 - ''; - - 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/default.nix b/pkgs/applications/office/libreoffice/darwin/default.nix new file mode 100644 index 0000000000000..2228d6bbfe6fd --- /dev/null +++ b/pkgs/applications/office/libreoffice/darwin/default.nix @@ -0,0 +1,80 @@ +{ stdenvNoCC +, lib +, fetchurl +, undmg +, writeScript +}: + +let + appName = "LibreOffice.app"; + scriptName = "soffice"; + version = "7.3.3"; + dist = { + aarch64-darwin = rec { + arch = "aarch64"; + archSuffix = arch; + 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 = "https://download.documentfoundation.org/libreoffice/stable/${version}/mac/${arch}/LibreOffice_${version}_MacOS_${archSuffix}.dmg"; + sha256 = "fb2f9bb90eee34a22af3a2bf2854ef5b76098302b3c41d13d4f543f0d72b994f"; + }; + }; +in +stdenvNoCC.mkDerivation { + inherit version; + pname = "libreoffice"; + src = fetchurl { + inherit (dist.${stdenvNoCC.hostPlatform.system} or + (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}")) url sha256; + }; + + nativeBuildInputs = [ undmg ]; + sourceRoot = "${appName}"; + + installPhase = '' + runHook preInstall + mkdir -p $out/{Applications/${appName},bin} + cp -R . $out/Applications/${appName} + cat > $out/bin/${scriptName} << EOF + #!${stdenvNoCC.shell} + open -na $out/Applications/${appName} --args "$@" + EOF + chmod +x $out/bin/${scriptName} + runHook postInstall + ''; + + 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; + in + writeScript "update-libreoffice.sh" + '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p common-updater-scripts + 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 + ''; + + 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" ]; + }; +} -- cgit 1.4.1