mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 11:53:27 +00:00
690eb0d43e
Fixes CVE-2022-3140 (https://www.libreoffice.org/about-us/security/advisories/CVE-2022-3140). https://wiki.documentfoundation.org/ReleaseNotes/7.4
81 lines
2.7 KiB
Nix
81 lines
2.7 KiB
Nix
{ stdenvNoCC
|
|
, lib
|
|
, fetchurl
|
|
, undmg
|
|
, writeScript
|
|
, callPackage
|
|
}:
|
|
|
|
let
|
|
appName = "LibreOffice.app";
|
|
scriptName = "soffice";
|
|
version = "7.4.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 = "cf95f9ecd4451d27e8304cea3ba116675267bdf75f08fbb60e0d8917f86edc04";
|
|
};
|
|
|
|
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 = "fe569ba23bb74eb3e86974537dd80e504debe5fd8526a00edbad6be4da18986a";
|
|
};
|
|
};
|
|
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
|
|
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 --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=${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/";
|
|
license = licenses.lgpl3;
|
|
maintainers = with maintainers; [ tricktron ];
|
|
platforms = [ "x86_64-darwin" "aarch64-darwin" ];
|
|
};
|
|
}
|