nixpkgs/pkgs/servers/mattermost/default.nix
2021-08-26 15:43:28 +10:00

58 lines
1.4 KiB
Nix

{ lib, stdenv, fetchurl, fetchFromGitHub, buildGoPackage, buildEnv }:
let
version = "5.32.1";
mattermost-server = buildGoPackage rec {
pname = "mattermost-server";
inherit version;
src = fetchFromGitHub {
owner = "mattermost";
repo = "mattermost-server";
rev = "v${version}";
sha256 = "BssrTfkIxUbXYXIfz9i+5b4rEYSzBim+/riK78m8Bxo=";
};
goPackagePath = "github.com/mattermost/mattermost-server";
ldflags = [
"-X ${goPackagePath}/model.BuildNumber=nixpkgs-${version}"
];
};
mattermost-webapp = stdenv.mkDerivation {
pname = "mattermost-webapp";
inherit version;
src = fetchurl {
url = "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz";
sha256 = "kRerl3fYRTrotj86AIFSor3GpjhABkCmego1ms9HmkQ=";
};
installPhase = ''
mkdir -p $out
tar --strip 1 --directory $out -xf $src \
mattermost/client \
mattermost/i18n \
mattermost/fonts \
mattermost/templates \
mattermost/config
'';
};
in
buildEnv {
name = "mattermost-${version}";
paths = [ mattermost-server mattermost-webapp ];
meta = with lib; {
description = "Open-source, self-hosted Slack-alternative";
homepage = "https://www.mattermost.org";
license = with licenses; [ agpl3 asl20 ];
maintainers = with maintainers; [ fpletz ryantm ];
platforms = platforms.unix;
};
}