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": {
|
"mattermost-server": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707502341,
|
"lastModified": 1707498729,
|
||||||
"narHash": "sha256-eloO83koCNZOR/NYzUCdKOtVdF7rk+VrZ9U2bKWkxNU=",
|
"narHash": "sha256-w+VF8VoS7oIcDlYS5kCFzSX4rgD9l1B99XBHeJDB6JI=",
|
||||||
"owner": "mattermost",
|
"owner": "mattermost",
|
||||||
"repo": "mattermost-server",
|
"repo": "mattermost",
|
||||||
"rev": "674f549daf0e74933845be0ae32827e498137b63",
|
"rev": "e9f10761eef2f9ed83fcf0be8205424bcc8df9f3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "mattermost",
|
"owner": "mattermost",
|
||||||
"ref": "v8.1.10",
|
"ref": "v9.5.1",
|
||||||
"repo": "mattermost-server",
|
"repo": "mattermost",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mattermost-webapp": {
|
"mattermost-webapp": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707771700,
|
"lastModified": 1707772650,
|
||||||
"narHash": "sha256-5PYPNcUGcQmn9RgUbtv3U/s+pRB1a2CgZwxDnunuToA=",
|
"narHash": "sha256-zOHWY0T1eM0PKBcNhAtMK3sNCYkSnmH7+o4aVu34dKg=",
|
||||||
"type": "tarball",
|
"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": {
|
"original": {
|
||||||
"type": "tarball",
|
"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": {
|
"nixos-mailserver": {
|
||||||
|
@ -162,6 +162,21 @@
|
||||||
"type": "github"
|
"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": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1708294118,
|
"lastModified": 1708294118,
|
||||||
|
@ -201,6 +216,7 @@
|
||||||
"nixos-mailserver": "nixos-mailserver",
|
"nixos-mailserver": "nixos-mailserver",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgs-oldstable": "nixpkgs-oldstable",
|
"nixpkgs-oldstable": "nixpkgs-oldstable",
|
||||||
|
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
"tracktrain": "tracktrain"
|
"tracktrain": "tracktrain"
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
description = "hacc infra stuff";
|
description = "hacc infra stuff";
|
||||||
|
|
||||||
inputs = {
|
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-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;
|
mattermost-server.flake = false;
|
||||||
|
|
||||||
nixpkgs.url = "nixpkgs/nixos-23.11";
|
nixpkgs.url = "nixpkgs/nixos-23.11";
|
||||||
|
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
|
||||||
nixpkgs-oldstable.url = "github:/NixOS/nixpkgs?rev=c4aec3c021620d98861639946123214207e98344";
|
nixpkgs-oldstable.url = "github:/NixOS/nixpkgs?rev=c4aec3c021620d98861639946123214207e98344";
|
||||||
|
|
||||||
nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-23.11";
|
nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-23.11";
|
||||||
|
|
|
@ -3,12 +3,16 @@
|
||||||
let
|
let
|
||||||
pkgs = import sources.nixpkgs args;
|
pkgs = import sources.nixpkgs args;
|
||||||
oldstable = import sources.nixpkgs-oldstable args;
|
oldstable = import sources.nixpkgs-oldstable args;
|
||||||
|
unstable = import sources.nixpkgs-unstable args;
|
||||||
|
|
||||||
callPackage = pkgs.lib.callPackageWith (pkgs // newpkgs);
|
callPackage = pkgs.lib.callPackageWith (pkgs // newpkgs);
|
||||||
|
|
||||||
newpkgs = {
|
newpkgs = {
|
||||||
|
|
||||||
mattermost = callPackage ./mattermost.nix {inherit sources;};
|
mattermost = callPackage ./mattermost.nix {
|
||||||
|
inherit sources;
|
||||||
|
buildGoModule = unstable.buildGo122Module;
|
||||||
|
};
|
||||||
|
|
||||||
tracktrain = import sources.tracktrain {
|
tracktrain = import sources.tracktrain {
|
||||||
nixpkgs = pkgs;
|
nixpkgs = pkgs;
|
||||||
|
|
|
@ -1,65 +1,74 @@
|
||||||
{ stdenv, fetchurl, fetchFromGitHub, buildGoModule, buildEnv, lib, sources }:
|
{ lib
|
||||||
|
, sources
|
||||||
|
, buildGoModule
|
||||||
|
, fetchFromGitHub
|
||||||
|
, nix-update-script
|
||||||
|
, fetchurl
|
||||||
|
, nixosTests
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
buildGoModule rec {
|
||||||
version = "8.1.10";
|
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 {
|
src = sources.mattermost-server;
|
||||||
pname = "mattermost-server";
|
webapp = sources.mattermost-webapp;
|
||||||
inherit version;
|
|
||||||
|
|
||||||
src = "${sources.mattermost-server}/server";
|
# Needed because buildGoModule does not support go workspaces yet.
|
||||||
|
# We use go 1.22's workspace vendor command, which is not yet available
|
||||||
# TODO: this should not be needed after the next update, assuming they don't
|
# in the default version of go used in nixpkgs, nor is it used by upstream:
|
||||||
# again push a release without running `go mod tidy`
|
# https://github.com/mattermost/mattermost/issues/26221#issuecomment-1945351597
|
||||||
overrideModAttrs = (_: {
|
overrideModAttrs = (_: {
|
||||||
preBuild = ''
|
buildPhase = ''
|
||||||
go mod tidy
|
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 = [
|
ldflags = [
|
||||||
"-s"
|
"-s"
|
||||||
"-w"
|
"-w"
|
||||||
"-X github.com/mattermost/mattermost/server/public/model.Version=${version}"
|
"-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.BuildDate=1970-01-01"
|
||||||
"-X github.com/mattermost/mattermost/server/public/model.BuildHash=v${version}"
|
"-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.BuildHashEnterprise=none"
|
||||||
"-X github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady=false"
|
"-X github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady=false"
|
||||||
"-X github.com/mattermost/mattermost/server/public/model.MockCWS=false"
|
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
mattermost-webapp = stdenv.mkDerivation {
|
postInstall = ''
|
||||||
pname = "mattermost-webapp";
|
cp -r $webapp/{client,i18n,fonts,templates,config} $out
|
||||||
inherit version;
|
# For some reason a bunch of these files are executable
|
||||||
|
find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \;
|
||||||
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
|
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
|
|
||||||
in
|
passthru = {
|
||||||
buildEnv {
|
updateScript = nix-update-script {
|
||||||
name = "mattermost-${version}";
|
extraArgs = [ "--version-regex" "^v(9\.5\.([0-9.]+))" ];
|
||||||
paths = [ mattermost-server mattermost-webapp ];
|
};
|
||||||
|
tests.mattermost = nixosTests.mattermost;
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
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";
|
homepage = "https://www.mattermost.org";
|
||||||
license = with licenses; [ agpl3 asl20 ];
|
license = with licenses; [ agpl3 asl20 ];
|
||||||
maintainers = with maintainers; [ fpletz ryantm ];
|
maintainers = with maintainers; [ ryantm numinit kranzes mgdelacroix ];
|
||||||
platforms = platforms.unix;
|
mainProgram = "mattermost";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue