Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
}