Skip to content

Commit

Permalink
[Backport release-24.11] mattermostLatest: init at 10.4.1; mattermost…
Browse files Browse the repository at this point in the history
…: 9.11.6 -> 9.11.7 (#375146)
  • Loading branch information
drupol authored Jan 19, 2025
2 parents d6bdd21 + 3b780d3 commit 1a04118
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 13 deletions.
53 changes: 40 additions & 13 deletions pkgs/by-name/ma/mattermost/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@
fetchNpmDeps,
jq,
nixosTests,

versionInfo ? {
# 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 here as well.
#
# Ensure you also check ../mattermostLatest/package.nix.
regex = "^v(9\\.11\\.[0-9]+)$";
version = "9.11.7";
srcHash = "sha256-KeGpYy3jr7/B2mtBk9em2MXJBJR2+Wajmvtz/yT4SG8=";
vendorHash = "sha256-alLPBfnA1o6bUUgPRqvYW/98UKR9wltmFTzKIGtVEm4=";
npmDepsHash = "sha256-ysz38ywGxJ5DXrrcDmcmezKbc5Y7aug9jOWUzHRAs/0=";
},
}:

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.11.6";
inherit (versionInfo) version;

src = fetchFromGitHub {
owner = "mattermost";
repo = "mattermost";
rev = "v${version}";
hash = "sha256-G9RYktnnVXdhNWp8q+bNbdlHB9ZOGtnESnZVOA7lDvE=";
tag = "v${version}";
hash = versionInfo.srcHash;
postFetch = ''
cd $out/webapp
Expand All @@ -31,6 +41,18 @@ buildGoModule rec {
def desuffix(version): version | gsub("^(?<prefix>[^\\+]+)\\+.*$"; "\(.prefix)");
.packages |= map_values(if has("version") then .version = desuffix(.version) else . end)
' < package-lock.json > package-lock.fixed.json
# Run the lockfile overlay, if present.
${lib.optionalString (versionInfo.lockfileOverlay or null != null) ''
${lib.getExe jq} ${lib.escapeShellArg ''
# Unlock a dependency and let npm-lockfile-fix relock it.
def unlock(root; dependency; path):
root | .packages[path] |= del(.resolved, .integrity)
| .packages[path].version = root.packages.channels.dependencies[dependency];
${versionInfo.lockfileOverlay}
''} < package-lock.fixed.json > package-lock.overlaid.json
mv package-lock.overlaid.json package-lock.fixed.json
''}
${lib.getExe npm-lockfile-fix} package-lock.fixed.json
rm -f package-lock.json
Expand All @@ -54,7 +76,7 @@ buildGoModule rec {
npmDeps = fetchNpmDeps {
inherit src;
sourceRoot = "${src.name}/webapp";
hash = "sha256-ysz38ywGxJ5DXrrcDmcmezKbc5Y7aug9jOWUzHRAs/0=";
hash = versionInfo.npmDepsHash;
makeCacheWritable = true;
forceGitDeps = true;
};
Expand Down Expand Up @@ -99,7 +121,7 @@ buildGoModule rec {
'';
};

vendorHash = "sha256-Gwv6clnq7ihoFC8ox8iEM5xp/us9jWUrcmqA9/XbxBE=";
inherit (versionInfo) vendorHash;

modRoot = "./server";
preBuild = ''
Expand Down Expand Up @@ -142,10 +164,15 @@ buildGoModule rec {

passthru = {
updateScript = nix-update-script {
extraArgs = [
"--version-regex"
"^v(9\\.11\\.[0-9]+)$"
];
extraArgs =
[
"--version-regex"
versionInfo.regex
]
++ lib.optionals (versionInfo.autoUpdate or null != null) [
"--override-filename"
versionInfo.autoUpdate
];
};
tests.mattermost = nixosTests.mattermost;
};
Expand Down
23 changes: 23 additions & 0 deletions pkgs/by-name/ma/mattermostLatest/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
mattermost,
}:

mattermost.override {
versionInfo = {
# Latest, non-RC releases only.
# If the latest is an ESR (Extended Support Release),
# duplicate it here to facilitate the update script.
# See https://docs.mattermost.com/about/mattermost-server-releases.html
# and make sure the version regex is up to date here.
# Ensure you also check ../mattermost/package.nix for ESR releases.
regex = "^v(10\\.[0-9]+\\.[0-9]+)$";
version = "10.4.1";
srcHash = "sha256-e7uT30tWhJpEQzlcDUY2huFcupDbe4l8B19Dgub2pg0=";
vendorHash = "sha256-AcemUxcBoytE/ZoXqaIlxkzAnmGV/C1laDqziMuE+XE=";
npmDepsHash = "sha256-HABPwdhtev9DZLhWJQsyU4g2ZueYgsX+tUduMsc74YY=";
lockfileOverlay = ''
unlock(.; "@floating-ui/react"; "channels/node_modules/@floating-ui/react")
'';
autoUpdate = ./package.nix;
};
}

0 comments on commit 1a04118

Please sign in to comment.