nixpkgs/pkgs/servers/mattermost/default.nix
stuebinm 7423f3c416 mattermost: 8.1.7 → 8.1.10
These are security releases, release notes can be found here:
https://docs.mattermost.com/deploy/legacy-self-hosted-changelog.html#release-v8-1-extended-support-release

Note on the use of `overrideModAttrs`: this is required because mattermost
8.1.10's go-modules derivation fails to build without first running `go mod tidy`.
However, running `go mod tidy` requires network access and will thus fail in
the module derivation itself, so we cannot just use a normal preBuild hook.
2024-02-17 01:11:41 +01:00

68 lines
2.1 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, fetchpatch
, fetchurl
, nixosTests
}:
buildGoModule rec {
pname = "mattermost";
version = "8.1.10";
src = fetchFromGitHub {
owner = "mattermost";
repo = "mattermost";
rev = "v${version}";
hash = "sha256-eloO83koCNZOR/NYzUCdKOtVdF7rk+VrZ9U2bKWkxNU=";
} + "/server";
# this can probably be removed again in versions newer than 8.1.10
overrideModAttrs = (_: {
preBuild = ''
go mod tidy
'';
});
webapp = fetchurl {
url = "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz";
hash = "sha256-qxFW/P+INcMKSzaGZtOOr1Mi/glgZeiKvQ+YN0qX070=";
};
vendorHash = "sha256-ZbLSxG9Gyhk7PBC2V6sMtrQNXvm+ugMfliFIHWO1VLs=";
subPackages = [ "cmd/mattermost" ];
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"
"-X github.com/mattermost/mattermost/server/public/model.MockCWS=false"
];
postInstall = ''
tar --strip 1 --directory $out -xf $webapp \
mattermost/{client,i18n,fonts,templates,config}
# For some reason a bunch of these files are executable
find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \;
'';
passthru.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";
};
}