nixpkgs/pkgs/servers/mattermost/default.nix
2023-02-04 17:15:09 -08:00

55 lines
1.8 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, fetchurl
, nixosTests
}:
buildGoModule rec {
pname = "mattermost";
version = "7.7.1";
src = fetchFromGitHub {
owner = "mattermost";
repo = "mattermost-server";
rev = "v${version}";
sha256 = "sha256-py1Ck/BGNGIlyVZXJPb9bYHLU8FTrBEIQwVkHvgHRLY";
};
webapp = fetchurl {
url = "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz";
sha256 = "sha256-4FrvKQdGKfwJM7Oc43kg1Iq4o/OT2/kl89bTKBO4EdQ";
};
vendorSha256 = "sha256-qJSddirC0VVFgKsttmNFZ1AzGR7jo07jXzrt7+DswXs=";
subPackages = [ "cmd/mattermost" ];
ldflags = [
"-s"
"-w"
"-X github.com/mattermost/mattermost-server/v6/model.Version=${version}"
"-X github.com/mattermost/mattermost-server/v6/model.BuildNumber=${version}-nixpkgs"
"-X github.com/mattermost/mattermost-server/v6/model.BuildDate=1970-01-01"
"-X github.com/mattermost/mattermost-server/v6/model.BuildHash=v${version}"
"-X github.com/mattermost/mattermost-server/v6/model.BuildHashEnterprise=v${version}"
"-X github.com/mattermost/mattermost-server/v6/model.BuildEnterpriseReady=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 ];
};
}