From 8315cf274bf02124dbdea8106d6cd7ccefbd9484 Mon Sep 17 00:00:00 2001 From: Thibault Gagnaux Date: Fri, 27 May 2022 15:48:59 +0200 Subject: [PATCH] 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;