push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
{
lib,
rustPlatform,
fetchFromGitHub,
fetchNpmDeps,
npmHooks,
nodejs,
python3,
pkg-config,
sqlite,
zstd,
stdenv,
open-policy-agent,
cctools,
nix-update-script,
versionCheckHook,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "matrix-authentication-service";
version = "1.3.0";
src = fetchFromGitHub {
owner = "element-hq";
repo = "matrix-authentication-service";
tag = "v${finalAttrs.version}";
hash = "sha256-iwQ+ItcpjShEyRi3RI0IuXXmlfzamGFHrdZpp7wBBis=";
};
cargoHash = "sha256-FgV2YfU2iqlYwoq3WCaM52fDmgKIQg2gx5q68P3Mhf0=";
npmDeps = fetchNpmDeps {
name = "${finalAttrs.pname}-${finalAttrs.version}-npm-deps";
src = "${finalAttrs.src}/${finalAttrs.npmRoot}";
hash = "sha256-PGT8UCjsgyARHw2/lbCAMSNQr/5FqbDz0Auf90jjHLk=";
};
npmRoot = "frontend";
npmFlags = [ "--legacy-peer-deps" ];
nativeBuildInputs = [
pkg-config
open-policy-agent
npmHooks.npmConfigHook
nodejs
(python3.withPackages (ps: [ ps.setuptools ])) # Used by gyp
]
++ lib.optional stdenv.hostPlatform.isDarwin cctools; # libtool used by gyp;
buildInputs = [
sqlite
zstd
];
env = {
ZSTD_SYS_USE_PKG_CONFIG = true;
VERGEN_GIT_DESCRIBE = finalAttrs.version;
};
buildNoDefaultFeatures = true;
buildFeatures = [ "dist" ];
postPatch = ''
substituteInPlace crates/config/src/sections/http.rs \
--replace-fail ./share/assets/ "$out/share/$pname/assets/"
substituteInPlace crates/config/src/sections/templates.rs \
--replace-fail ./share/templates/ "$out/share/$pname/templates/" \
--replace-fail ./share/translations/ "$out/share/$pname/translations/" \
--replace-fail ./share/manifest.json "$out/share/$pname/assets/manifest.json"
substituteInPlace crates/config/src/sections/policy.rs \
--replace-fail ./share/policy.wasm "$out/share/$pname/policy.wasm"
'';
preBuild = ''
make -C policies
(cd "$npmRoot" && npm run build)
'';
# Adapted from https://github.com/element-hq/matrix-authentication-service/blob/v0.20.0/.github/workflows/build.yaml#L75-L84
postInstall = ''
install -Dm444 -t "$out/share/$pname" "policies/policy.wasm"
install -Dm444 -t "$out/share/$pname" "$npmRoot/dist/manifest.json"
install -Dm444 -t "$out/share/$pname/assets" "$npmRoot/dist/"*
cp -r templates "$out/share/$pname/templates"
cp -r translations "$out/share/$pname/translations"
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;
passthru.updateScript = nix-update-script {
extraArgs = [
# avoid unstable prereleases
"--version-regex"
"^v([0-9.]+)$"
];
};
meta = {
description = "OAuth2.0 + OpenID Provider for Matrix Homeservers";
homepage = "https://github.com/element-hq/matrix-authentication-service";
changelog = "https://github.com/element-hq/matrix-authentication-service/releases/tag/v${finalAttrs.version}";
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ teutat3s ];
mainProgram = "mas-cli";
};
})