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.
This commit is contained in:
Thibault Gagnaux 2022-05-27 15:48:59 +02:00
parent b9a5485aa5
commit 8315cf274b
No known key found for this signature in database
GPG Key ID: 44BD0764ACAE8E25
4 changed files with 21 additions and 20 deletions

View File

@ -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" ];
};
}

View File

@ -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" ];
};
}

View File

@ -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; }))

View File

@ -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;