From 50438eba6c9437e533e17aa7cd9ff0e6e3f14d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Mon, 24 Aug 2020 13:07:33 +0200 Subject: [PATCH] softmaker-office, freeoffice: make it easy to override versions Make the edition, version, and hash easier to override to support users who have a license for an older version of Softmaker Office. With this change one can e.g. use Softmaker Office 2018 with: softmaker-office.override { officeVersion = { edition = "2018"; version = "976"; sha256 = "0j6zm0cbxrcgm7glk84hvvbp4z0ys6v8bkwwhl5r7dbphyi72fw8"; }; } This also helps people fix things when upstream has replaced the previous version's tarball and this hasn't been fixed in nixpkgs yet. --- .../office/softmaker/freeoffice.nix | 20 ++++++++++++++---- .../office/softmaker/softmaker_office.nix | 21 +++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/office/softmaker/freeoffice.nix b/pkgs/applications/office/softmaker/freeoffice.nix index d9f901ff4635..634a696a73e2 100644 --- a/pkgs/applications/office/softmaker/freeoffice.nix +++ b/pkgs/applications/office/softmaker/freeoffice.nix @@ -1,14 +1,26 @@ -{ callPackage, fetchurl, ... } @ args: +{ callPackage +, fetchurl -callPackage ./generic.nix (args // rec { - pname = "freeoffice"; + # This is a bit unusual, but makes version and hash easily + # overridable. This is useful when the upstream archive was replaced + # and nixpkgs is not in sync yet. +, officeVersion ? { version = "976"; edition = "2018"; + sha256 = "13yh4lyqakbdqf4r8vw8imy5gwpfva697iqfd85qmp3wimqvzskl"; +} + +, ... } @ args: + +callPackage ./generic.nix (args // rec { + inherit (officeVersion) version edition; + + pname = "freeoffice"; suiteName = "FreeOffice"; src = fetchurl { + inherit (officeVersion) sha256; url = "https://www.softmaker.net/down/softmaker-freeoffice-${version}-amd64.tgz"; - sha256 = "13yh4lyqakbdqf4r8vw8imy5gwpfva697iqfd85qmp3wimqvzskl"; }; archive = "freeoffice${edition}.tar.lzma"; diff --git a/pkgs/applications/office/softmaker/softmaker_office.nix b/pkgs/applications/office/softmaker/softmaker_office.nix index e41e9fc8b29e..6aaa8c6745a7 100644 --- a/pkgs/applications/office/softmaker/softmaker_office.nix +++ b/pkgs/applications/office/softmaker/softmaker_office.nix @@ -1,14 +1,27 @@ -{ callPackage, fetchurl, ... } @ args: +{ callPackage +, fetchurl -callPackage ./generic.nix (args // rec { - pname = "softmaker-office"; + # This is a bit unusual, but makes version and hash easily + # overridable. This is useful when people have an older version of + # Softmaker Office or when the upstream archive was replaced and + # nixpkgs is not in sync yet. +, officeVersion ? { version = "1018"; edition = "2021"; + sha256 = "1g9mcn0z7s3xw7d5bcjxbnamh6knzndcysahydskfcds6czdxg0c"; +} + +, ... } @ args: + +callPackage ./generic.nix (args // rec { + inherit (officeVersion) version edition; + + pname = "softmaker-office"; suiteName = "SoftMaker Office"; src = fetchurl { + inherit (officeVersion) sha256; url = "https://www.softmaker.net/down/softmaker-office-${edition}-${version}-amd64.tgz"; - sha256 = "1g9mcn0z7s3xw7d5bcjxbnamh6knzndcysahydskfcds6czdxg0c"; }; archive = "office${edition}.tar.lzma";