diff --git a/pkgs/servers/mattermost/default.nix b/pkgs/servers/mattermost/default.nix index 0abe7e659e27ceb..c76dd152929c35c 100644 --- a/pkgs/servers/mattermost/default.nix +++ b/pkgs/servers/mattermost/default.nix @@ -1,35 +1,48 @@ { lib , buildGoModule , fetchFromGitHub -, fetchpatch +, nix-update-script , fetchurl , nixosTests }: buildGoModule rec { pname = "mattermost"; - version = "8.1.10"; + # ESR releases only. + # See https://docs.mattermost.com/upgrade/extended-support-release.html + # When a new ESR version is available (e.g. 8.1.x -> 9.5.x), update + # the version regex in passthru.updateScript as well. + 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 +57,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 = '' @@ -55,7 +67,12 @@ buildGoModule rec { find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \; ''; - passthru.tests.mattermost = nixosTests.mattermost; + passthru = { + updateScript = nix-update-script { + extraArgs = [ "--version-regex" "^v(9\.5\.([0-9.]+))" ]; + }; + tests.mattermost = nixosTests.mattermost; + }; meta = with lib; { description = "Mattermost is an open source platform for secure collaboration across the entire software development lifecycle"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 81f4de98988a94f..e8a5bb73d67ba0c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26411,7 +26411,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 { };