mattermostLatest: init at 10.4.1; mattermost: 9.11.6 -> 9.11.7 (#373113)

This commit is contained in:
Pol Dellaiera
2025-01-19 19:09:37 +01:00
committed by GitHub
2 changed files with 63 additions and 13 deletions
+40 -13
View File
@@ -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
@@ -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
@@ -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;
};
@@ -99,7 +121,7 @@ buildGoModule rec {
'';
};
vendorHash = "sha256-Gwv6clnq7ihoFC8ox8iEM5xp/us9jWUrcmqA9/XbxBE=";
inherit (versionInfo) vendorHash;
modRoot = "./server";
preBuild = ''
@@ -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;
};
@@ -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;
};
}