From 086388fc15419bd9000378056a4369f63948ab1a Mon Sep 17 00:00:00 2001 From: stuebinm Date: Sun, 25 Feb 2024 18:49:15 +0100 Subject: [PATCH] =?UTF-8?q?mattermost:=208.1.10=20=E2=86=92=209.5.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This jumps Mattermost ESR Versions (see [1] for their release cycle). The new version makes use of Go's workspace feature, which unfortunately the buildGoModule function does not (yet?) support [2], which breaks the previous build process for mattermost. Further, the new release also makes use of private modules only included in the (non-free) enterprise version of mattermost which makes it impossible to build in the usual way even outside of nixpkgs's build abstractions [3]. Both issues can be solved by using Go 1.22, which has added support for vendoring when using workspaces, and instructing it to ignore errors with the -e flag. This requires overriding the go-modules derivation's buildPhase, and still produces a functional binary. [1] https://docs.mattermost.com/upgrade/extended-support-release.html [2] https://github.com/NixOS/nixpkgs/issues/203039 [3] https://github.com/mattermost/mattermost/issues/26221 --- pkgs/servers/mattermost/default.nix | 28 ++++++++++++++++++---------- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/pkgs/servers/mattermost/default.nix b/pkgs/servers/mattermost/default.nix index 0abe7e659e27..dbe887ee869d 100644 --- a/pkgs/servers/mattermost/default.nix +++ b/pkgs/servers/mattermost/default.nix @@ -1,35 +1,44 @@ { lib , buildGoModule , fetchFromGitHub -, fetchpatch , fetchurl , nixosTests }: buildGoModule rec { pname = "mattermost"; - version = "8.1.10"; + # ESR releases only. + version = "9.5.1"; src = fetchFromGitHub { owner = "mattermost"; repo = "mattermost"; rev = "v${version}"; - hash = "sha256-eloO83koCNZOR/NYzUCdKOtVdF7rk+VrZ9U2bKWkxNU="; - } + "/server"; + hash = "sha256-w+VF8VoS7oIcDlYS5kCFzSX4rgD9l1B99XBHeJDB6JI="; + }; - # this can probably be removed again in versions newer than 8.1.10 + # Needed because buildGoModule does not support go workspaces yet. + # We use go 1.22's workspace vendor command, which is not yet available + # in the default version of go used in nixpkgs, nor is it used by upstream: + # https://github.com/mattermost/mattermost/issues/26221#issuecomment-1945351597 overrideModAttrs = (_: { - preBuild = '' - go mod tidy + buildPhase = '' + make setup-go-work + go work vendor -e ''; }); webapp = fetchurl { url = "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz"; - hash = "sha256-qxFW/P+INcMKSzaGZtOOr1Mi/glgZeiKvQ+YN0qX070="; + hash = "sha256-F32NWulKUhoyHPCmCCih6Hb9+W2iuF/Mxy9USrgp1pM="; }; - vendorHash = "sha256-ZbLSxG9Gyhk7PBC2V6sMtrQNXvm+ugMfliFIHWO1VLs="; + vendorHash = "sha256-TJCtgNf56A1U0EbV5gXjTro+YudVBRWiSZoBC3nJxnE="; + + modRoot = "./server"; + preBuild = '' + make setup-go-work + ''; subPackages = [ "cmd/mattermost" ]; @@ -44,7 +53,6 @@ buildGoModule rec { "-X github.com/mattermost/mattermost/server/public/model.BuildHash=v${version}" "-X github.com/mattermost/mattermost/server/public/model.BuildHashEnterprise=none" "-X github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady=false" - "-X github.com/mattermost/mattermost/server/public/model.MockCWS=false" ]; postInstall = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 022bc915b18d..da789cfe1096 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26455,7 +26455,7 @@ with pkgs; matrix-alertmanager = callPackage ../servers/monitoring/matrix-alertmanager { }; - mattermost = callPackage ../servers/mattermost { }; + mattermost = callPackage ../servers/mattermost { buildGoModule = buildGo122Module; }; matterircd = callPackage ../servers/mattermost/matterircd.nix { }; matterbridge = callPackage ../servers/matterbridge { };