stuebinm
e12cc7dbf5
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], and unfortunately this 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. Finally, this now also build the commands/mmctl subpackage, which contains a cli utility to administrate mattermost. This currently has its own nixpkgs package for no reason i can see at all (it also has a version mismatch between nixpkgs's mattermost and nixpkgs's mmctl). [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
74 lines
2.4 KiB
Nix
74 lines
2.4 KiB
Nix
{ lib
|
|
, sources
|
|
, buildGoModule
|
|
, fetchFromGitHub
|
|
, nix-update-script
|
|
, fetchurl
|
|
, nixosTests
|
|
}:
|
|
|
|
buildGoModule rec {
|
|
pname = "mattermost";
|
|
# 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 = sources.mattermost-server;
|
|
webapp = sources.mattermost-webapp;
|
|
|
|
# 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 = (_: {
|
|
buildPhase = ''
|
|
make setup-go-work
|
|
go work vendor -e
|
|
'';
|
|
});
|
|
|
|
vendorHash = "sha256-TJCtgNf56A1U0EbV5gXjTro+YudVBRWiSZoBC3nJxnE=";
|
|
|
|
modRoot = "./server";
|
|
preBuild = ''
|
|
make setup-go-work
|
|
'';
|
|
|
|
subPackages = [ "cmd/mattermost" "cmd/mmctl" ];
|
|
|
|
tags = [ "production" ];
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X github.com/mattermost/mattermost/server/public/model.Version=${version}"
|
|
"-X github.com/mattermost/mattermost/server/public/model.BuildNumber=${version}-nixpkgs"
|
|
"-X github.com/mattermost/mattermost/server/public/model.BuildDate=1970-01-01"
|
|
"-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"
|
|
];
|
|
|
|
postInstall = ''
|
|
cp -r $webapp/{client,i18n,fonts,templates,config} $out
|
|
# For some reason a bunch of these files are executable
|
|
find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \;
|
|
'';
|
|
|
|
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";
|
|
homepage = "https://www.mattermost.org";
|
|
license = with licenses; [ agpl3 asl20 ];
|
|
maintainers = with maintainers; [ ryantm numinit kranzes mgdelacroix ];
|
|
mainProgram = "mattermost";
|
|
};
|
|
}
|