Files
Dark Steveneq 646b892680
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
push sheeet
2025-10-09 14:15:47 +02:00

146 lines
2.9 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
nodejs,
yarn-berry,
cacert,
nix-update-script,
formats,
baseUrl ? null,
}:
let
config = lib.optionalAttrs (baseUrl != null) { restrictBaseUrl = baseUrl; };
configFormat = formats.json { };
configFile = configFormat.generate "synapse-admin-config" config;
in
stdenv.mkDerivation (finalAttrs: {
pname = "synapse-admin";
version = "0.11.1";
src = fetchFromGitHub {
owner = "Awesome-Technologies";
repo = "synapse-admin";
tag = finalAttrs.version;
hash = "sha256-rK1Tc1K3wx6/1J8TEw5Lb9g09gbt/1HoZdDrEFzxTQQ=";
};
# we cannot use fetchYarnDeps because that doesn't support yarn 2/berry lockfiles
yarnOfflineCache = stdenv.mkDerivation {
pname = "yarn-deps";
inherit (finalAttrs) version src;
nativeBuildInputs = [ yarn-berry ];
dontInstall = true;
env = {
YARN_ENABLE_TELEMETRY = 0;
NODE_EXTRA_CA_CERTS = "${cacert}/etc/ssl/certs/ca-bundle.crt";
};
supportedArchitectures = builtins.toJSON {
os = [
"darwin"
"linux"
];
cpu = [
"arm"
"arm64"
"ia32"
"x64"
];
libc = [
"glibc"
"musl"
];
};
configurePhase = ''
runHook preConfigure
export HOME="$NIX_BUILD_TOP"
yarn config set enableGlobalCache false
yarn config set cacheFolder $out
yarn config set --json supportedArchitectures "$supportedArchitectures"
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
mkdir -p $out
yarn install --immutable --mode skip-build
runHook postBuild
'';
outputHash = "sha256-IiViodAB1KAYsRRr8+zw3vrCbUYp7Mdtazi0Y6SEFNU=";
outputHashMode = "recursive";
};
nativeBuildInputs = [
nodejs
yarn-berry
];
env = {
NODE_ENV = "production";
};
postPatch = ''
substituteInPlace vite.config.ts \
--replace-fail "git describe --tags" "echo ${finalAttrs.version}"
'';
configurePhase = ''
runHook preConfigure
export HOME="$NIX_BUILD_TOP"
yarn config set enableGlobalCache false
yarn config set cacheFolder $yarnOfflineCache
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
yarn install --immutable --immutable-cache
yarn build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -r dist $out
cp ${configFile} $out/config.json
runHook postInstall
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Admin UI for Synapse Homeservers";
homepage = "https://github.com/Awesome-Technologies/synapse-admin";
changelog = "https://github.com/Awesome-Technologies/synapse-admin/releases/tag/${finalAttrs.version}";
license = lib.licenses.asl20;
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
maintainers = with lib.maintainers; [
mkg20001
ma27
];
};
})