2024-02-21 16:38:40 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, nix-update-script
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
|
|
|
}:
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
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.
|
2024-10-11 12:16:18 +00:00
|
|
|
version = "9.11.3";
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-03-10 23:13:18 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mattermost";
|
|
|
|
repo = "mattermost";
|
|
|
|
rev = "v${version}";
|
2024-10-11 12:16:18 +00:00
|
|
|
hash = "sha256-CuFkydl1ZZUAWmrDIV1Jp9S6jIKYmglAe5XW2lTRgtQ=";
|
2024-03-10 23:13:18 +00:00
|
|
|
};
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
});
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-03-10 23:13:18 +00:00
|
|
|
webapp = fetchurl {
|
|
|
|
url = "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz";
|
2024-10-11 12:16:18 +00:00
|
|
|
hash = "sha256-4JzhL2+G3T98pNFgKugs/eoSrbm7QSk5grVlprrIKEI=";
|
2024-03-10 23:13:18 +00:00
|
|
|
};
|
|
|
|
|
2024-09-27 13:22:05 +00:00
|
|
|
vendorHash = "sha256-Gwv6clnq7ihoFC8ox8iEM5xp/us9jWUrcmqA9/XbxBE=";
|
2024-02-16 18:32:28 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
modRoot = "./server";
|
|
|
|
preBuild = ''
|
|
|
|
make setup-go-work
|
|
|
|
'';
|
2022-11-26 15:02:57 +00:00
|
|
|
|
2024-03-10 23:13:18 +00:00
|
|
|
subPackages = [ "cmd/mattermost" ];
|
2024-08-17 19:58:50 +00:00
|
|
|
offlineCache = webapp;
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
tags = [ "production" ];
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
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"
|
|
|
|
];
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
postInstall = ''
|
2024-03-10 23:13:18 +00:00
|
|
|
tar --strip 1 --directory $out -xf $webapp \
|
|
|
|
mattermost/{client,i18n,fonts,templates,config}
|
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
# For some reason a bunch of these files are executable
|
|
|
|
find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \;
|
|
|
|
'';
|
2021-03-25 13:59:59 +00:00
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script {
|
2024-08-17 20:01:18 +00:00
|
|
|
extraArgs = [ "--version-regex" "^v(9\.11\.([0-9.]+))" ];
|
2024-02-21 16:38:40 +00:00
|
|
|
};
|
|
|
|
tests.mattermost = nixosTests.mattermost;
|
2021-03-25 13:59:59 +00:00
|
|
|
};
|
|
|
|
|
2024-02-21 16:38:40 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Mattermost is an open source platform for secure collaboration across the entire software development lifecycle";
|
|
|
|
homepage = "https://www.mattermost.org";
|
2024-06-04 20:02:39 +00:00
|
|
|
license = with licenses; [ agpl3Only asl20 ];
|
2024-02-21 16:38:40 +00:00
|
|
|
maintainers = with maintainers; [ ryantm numinit kranzes mgdelacroix ];
|
|
|
|
mainProgram = "mattermost";
|
|
|
|
};
|
|
|
|
}
|