diff --git a/nixos/modules/services/web-apps/mattermost.nix b/nixos/modules/services/web-apps/mattermost.nix index 0b637e3991b..be74a2b1955 100644 --- a/nixos/modules/services/web-apps/mattermost.nix +++ b/nixos/modules/services/web-apps/mattermost.nix @@ -173,7 +173,7 @@ in preStart = '' mkdir -p ${cfg.statePath}/{data,config,logs} - ln -sf ${pkgs.mattermost}/{bin,fonts,i18n,templates,webapp} ${cfg.statePath} + ln -sf ${pkgs.mattermost}/{bin,fonts,i18n,templates,client} ${cfg.statePath} '' + lib.optionalString (!cfg.mutableConfig) '' ln -sf ${mattermostConfJSON} ${cfg.statePath}/config/config.json '' + lib.optionalString cfg.mutableConfig '' diff --git a/pkgs/servers/mattermost/default.nix b/pkgs/servers/mattermost/default.nix index c99f939437b..2bfe929784b 100644 --- a/pkgs/servers/mattermost/default.nix +++ b/pkgs/servers/mattermost/default.nix @@ -1,22 +1,37 @@ -{ stdenv, fetchurl }: +{ stdenv, fetchurl, fetchFromGitHub, buildGoPackage }: -stdenv.mkDerivation rec { +buildGoPackage rec { name = "mattermost-${version}"; - version = "4.1.0"; + version = "4.3.0"; - src = fetchurl { - url = "https://releases.mattermost.com/${version}/mattermost-team-${version}-linux-amd64.tar.gz"; - sha256 = "0bp56i108pxsqcswxy1hdz3d8wq83lc29wcq6npimwx566rx4xhf"; + src = fetchFromGitHub { + owner = "mattermost"; + repo = "mattermost-server"; + rev = "v${version}"; + sha256 = "05119h3x81p8plfjq99khfywc3plv2zynvf83vkhj48zqk61wvbq"; }; - installPhase = '' - mkdir -p $out - mv * $out/ - ln -s ./platform $out/bin/mattermost-platform + webApp = fetchurl { + url = "https://releases.mattermost.com/${version}/mattermost-team-${version}-linux-amd64.tar.gz"; + sha256 = "0d30zj036nz6vwpiv0mn656j5r4br6y4x8iqc5jn785fiwk2pdls"; + }; + + goPackagePath = "github.com/mattermost/mattermost-server"; + + buildPhase = '' + runHook preBuild + cd go/src/${goPackagePath}/cmd/platform + go install + runHook postBuild ''; - postFixup = '' - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/bin/platform + preInstall = '' + mkdir -p $bin + tar --strip 1 -C $bin -xf $webApp + ''; + + postInstall = '' + ln -s $bin/bin/platform $bin/bin/mattermost-platform ''; meta = with stdenv.lib; { @@ -24,6 +39,6 @@ stdenv.mkDerivation rec { homepage = https://www.mattermost.org; license = with licenses; [ agpl3 asl20 ]; maintainers = with maintainers; [ fpletz ]; - platforms = [ "x86_64-linux" ]; + platforms = platforms.unix; }; }