mattermost: 8.1.10 → 9.5.1
This jumps Mattermost ESR Versions (see [1] for their release cycle). The new version makes use of Go's workspace feature, which unfortunately the buildGoModule function does not (yet?) support [2], and unfortunately this breaks the previous build process for mattermost. Further, the new release also makes use of private modules only included in the (non-free) enterprise version of mattermost which makes it impossible to build in the usual way even outside of nixpkgs's build abstractions [3]. Both issues can be solved by using Go 1.22, which has added support for vendoring when using workspaces, and instructing it to ignore errors with the -e flag. This requires overriding the go-modules derivation's buildPhase. Finally, this now also build the commands/mmctl subpackage, which contains a cli utility to administrate mattermost. This currently has its own nixpkgs package for no reason i can see at all (it also has a version mismatch between nixpkgs's mattermost and nixpkgs's mmctl). [1] https://docs.mattermost.com/upgrade/extended-support-release.html [2] https://github.com/NixOS/nixpkgs/issues/203039 [3] https://github.com/mattermost/mattermost/issues/26221
This commit is contained in:
parent
cbc7827cb9
commit
e12cc7dbf5
4 changed files with 102 additions and 72 deletions
36
flake.lock
36
flake.lock
|
@ -57,31 +57,31 @@
|
|||
"mattermost-server": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1707502341,
|
||||
"narHash": "sha256-eloO83koCNZOR/NYzUCdKOtVdF7rk+VrZ9U2bKWkxNU=",
|
||||
"lastModified": 1707498729,
|
||||
"narHash": "sha256-w+VF8VoS7oIcDlYS5kCFzSX4rgD9l1B99XBHeJDB6JI=",
|
||||
"owner": "mattermost",
|
||||
"repo": "mattermost-server",
|
||||
"rev": "674f549daf0e74933845be0ae32827e498137b63",
|
||||
"repo": "mattermost",
|
||||
"rev": "e9f10761eef2f9ed83fcf0be8205424bcc8df9f3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "mattermost",
|
||||
"ref": "v8.1.10",
|
||||
"repo": "mattermost-server",
|
||||
"ref": "v9.5.1",
|
||||
"repo": "mattermost",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mattermost-webapp": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1707771700,
|
||||
"narHash": "sha256-5PYPNcUGcQmn9RgUbtv3U/s+pRB1a2CgZwxDnunuToA=",
|
||||
"lastModified": 1707772650,
|
||||
"narHash": "sha256-zOHWY0T1eM0PKBcNhAtMK3sNCYkSnmH7+o4aVu34dKg=",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.mattermost.com/8.1.10/mattermost-8.1.10-linux-amd64.tar.gz"
|
||||
"url": "https://releases.mattermost.com/9.5.1/mattermost-9.5.1-linux-amd64.tar.gz"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://releases.mattermost.com/8.1.10/mattermost-8.1.10-linux-amd64.tar.gz"
|
||||
"url": "https://releases.mattermost.com/9.5.1/mattermost-9.5.1-linux-amd64.tar.gz"
|
||||
}
|
||||
},
|
||||
"nixos-mailserver": {
|
||||
|
@ -162,6 +162,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1708475490,
|
||||
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1708294118,
|
||||
|
@ -201,6 +216,7 @@
|
|||
"nixos-mailserver": "nixos-mailserver",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-oldstable": "nixpkgs-oldstable",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"sops-nix": "sops-nix",
|
||||
"tracktrain": "tracktrain"
|
||||
}
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
description = "hacc infra stuff";
|
||||
|
||||
inputs = {
|
||||
mattermost-webapp.url = "https://releases.mattermost.com/8.1.10/mattermost-8.1.10-linux-amd64.tar.gz";
|
||||
mattermost-webapp.url = "https://releases.mattermost.com/9.5.1/mattermost-9.5.1-linux-amd64.tar.gz";
|
||||
mattermost-webapp.flake = false;
|
||||
mattermost-server.url = "github:mattermost/mattermost-server?ref=v8.1.10";
|
||||
mattermost-server.url = "github:mattermost/mattermost?ref=v9.5.1";
|
||||
mattermost-server.flake = false;
|
||||
|
||||
nixpkgs.url = "nixpkgs/nixos-23.11";
|
||||
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
|
||||
nixpkgs-oldstable.url = "github:/NixOS/nixpkgs?rev=c4aec3c021620d98861639946123214207e98344";
|
||||
|
||||
nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-23.11";
|
||||
|
|
|
@ -3,12 +3,16 @@
|
|||
let
|
||||
pkgs = import sources.nixpkgs args;
|
||||
oldstable = import sources.nixpkgs-oldstable args;
|
||||
unstable = import sources.nixpkgs-unstable args;
|
||||
|
||||
callPackage = pkgs.lib.callPackageWith (pkgs // newpkgs);
|
||||
|
||||
newpkgs = {
|
||||
|
||||
mattermost = callPackage ./mattermost.nix {inherit sources;};
|
||||
mattermost = callPackage ./mattermost.nix {
|
||||
inherit sources;
|
||||
buildGoModule = unstable.buildGo122Module;
|
||||
};
|
||||
|
||||
tracktrain = import sources.tracktrain {
|
||||
nixpkgs = pkgs;
|
||||
|
|
|
@ -1,65 +1,74 @@
|
|||
{ stdenv, fetchurl, fetchFromGitHub, buildGoModule, buildEnv, lib, sources }:
|
||||
{ lib
|
||||
, sources
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, nix-update-script
|
||||
, fetchurl
|
||||
, nixosTests
|
||||
}:
|
||||
|
||||
let
|
||||
version = "8.1.10";
|
||||
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.
|
||||
version = "9.5.1";
|
||||
|
||||
mattermost-server = buildGoModule rec {
|
||||
pname = "mattermost-server";
|
||||
inherit version;
|
||||
src = sources.mattermost-server;
|
||||
webapp = sources.mattermost-webapp;
|
||||
|
||||
src = "${sources.mattermost-server}/server";
|
||||
|
||||
# TODO: this should not be needed after the next update, assuming they don't
|
||||
# again push a release without running `go mod tidy`
|
||||
# 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 = (_: {
|
||||
preBuild = ''
|
||||
go mod tidy
|
||||
buildPhase = ''
|
||||
make setup-go-work
|
||||
go work vendor -e
|
||||
'';
|
||||
});
|
||||
|
||||
vendorHash = "sha256-ZbLSxG9Gyhk7PBC2V6sMtrQNXvm+ugMfliFIHWO1VLs=";
|
||||
vendorHash = "sha256-TJCtgNf56A1U0EbV5gXjTro+YudVBRWiSZoBC3nJxnE=";
|
||||
|
||||
subPackages = [ "cmd/mattermost" ];
|
||||
modRoot = "./server";
|
||||
preBuild = ''
|
||||
make setup-go-work
|
||||
'';
|
||||
|
||||
subPackages = [ "cmd/mattermost" "cmd/mmctl" ];
|
||||
|
||||
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}-haccfiles"
|
||||
"-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"
|
||||
];
|
||||
};
|
||||
|
||||
mattermost-webapp = stdenv.mkDerivation {
|
||||
pname = "mattermost-webapp";
|
||||
inherit version;
|
||||
|
||||
src = sources.mattermost-webapp;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r client $out
|
||||
cp -r i18n $out
|
||||
cp -r fonts $out
|
||||
cp -r templates $out
|
||||
cp -r config $out
|
||||
postInstall = ''
|
||||
cp -r $webapp/{client,i18n,fonts,templates,config} $out
|
||||
# For some reason a bunch of these files are executable
|
||||
find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \;
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
buildEnv {
|
||||
name = "mattermost-${version}";
|
||||
paths = [ mattermost-server mattermost-webapp ];
|
||||
passthru = {
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [ "--version-regex" "^v(9\.5\.([0-9.]+))" ];
|
||||
};
|
||||
tests.mattermost = nixosTests.mattermost;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Open-source, self-hosted Slack-alternative";
|
||||
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; [ fpletz ryantm ];
|
||||
platforms = platforms.unix;
|
||||
maintainers = with maintainers; [ ryantm numinit kranzes mgdelacroix ];
|
||||
mainProgram = "mattermost";
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue