12 # See https://docs.mattermost.com/upgrade/extended-support-release.html
13 # When a new ESR version is available (e.g. 8.1.x -> 9.5.x), update
14 # the version regex in passthru.updateScript as well.
17 src = fetchFromGitHub {
21 hash = "sha256-bLnvbduP6h9o82BQUNh9MyFpW/Cbl6c5o9hrPV0Z8+0=";
24 # Needed because buildGoModule does not support go workspaces yet.
25 # We use go 1.22's workspace vendor command, which is not yet available
26 # in the default version of go used in nixpkgs, nor is it used by upstream:
27 # https://github.com/mattermost/mattermost/issues/26221#issuecomment-1945351597
28 overrideModAttrs = (_: {
36 url = "https://releases.mattermost.com/${version}/mattermost-${version}-linux-amd64.tar.gz";
37 hash = "sha256-ZlvO/7kdMopIHBDdFp6wSQCR+NobGdDC6PcVd1iG16E=";
40 # Makes nix-update-script pick up the fetchurl for the webapp.
41 # https://github.com/Mic92/nix-update/blob/1.3.1/nix_update/eval.py#L179
42 offlineCache = webapp;
44 vendorHash = "sha256-TJCtgNf56A1U0EbV5gXjTro+YudVBRWiSZoBC3nJxnE=";
51 subPackages = [ "cmd/mattermost" ];
53 tags = [ "production" ];
58 "-X github.com/mattermost/mattermost/server/public/model.Version=${version}"
59 "-X github.com/mattermost/mattermost/server/public/model.BuildNumber=${version}-nixpkgs"
60 "-X github.com/mattermost/mattermost/server/public/model.BuildDate=1970-01-01"
61 "-X github.com/mattermost/mattermost/server/public/model.BuildHash=v${version}"
62 "-X github.com/mattermost/mattermost/server/public/model.BuildHashEnterprise=none"
63 "-X github.com/mattermost/mattermost/server/public/model.BuildEnterpriseReady=false"
67 tar --strip 1 --directory $out -xf $webapp \
68 mattermost/{client,i18n,fonts,templates,config}
70 # For some reason a bunch of these files are executable
71 find $out/{client,i18n,fonts,templates,config} -type f -exec chmod -x {} \;
75 updateScript = nix-update-script {
76 extraArgs = [ "--version-regex" "^v(9\.5\.[0-9]+)$" ];
78 tests.mattermost = nixosTests.mattermost;
82 description = "Mattermost is an open source platform for secure collaboration across the entire software development lifecycle";
83 homepage = "https://www.mattermost.org";
84 license = with licenses; [ agpl3Only asl20 ];
85 maintainers = with maintainers; [ ryantm numinit kranzes mgdelacroix ];
86 mainProgram = "mattermost";