Files
nixpkgs/pkgs/by-name/sy/synapse-admin/package.nix
Emily fdb820602b treewide: drop simple x86_64-darwin mentions
To reproduce:

    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: nix-x86_64-darwin
          language: nix
          rule:
            any:
              - pattern: "\"x86_64-darwin\""
                kind: list_expression > string_expression
              - pattern:
                  context: "{ \"x86_64-darwin\" = $EXPR; }"
                  selector: binding
              - pattern:
                  context: "{ x86_64-darwin = $EXPR; }"
                  selector: binding
          fix:
            template: ""
        ' pkgs
    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: json-first-x86_64-darwin
          language: json
          rule:
            kind: object > pair:nth-child(1)
            has:
              pattern: "\"x86_64-darwin\""
              field: key
          fix:
            template: ""
            expandEnd: { regex: "," }
        ' pkgs
    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: json-x86_64-darwin
          language: json
          rule:
            kind: object > pair
            has:
              pattern: "\"x86_64-darwin\""
              field: key
          fix:
            template: ""
            expandStart: { regex: "," }
        ' pkgs
    $ git restore pkgs/by-name/om/omnix/package.nix
    $ git diff --name-only -z \
        | nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
            -c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
    $ treefmt
2026-07-15 03:58:16 +01:00

151 lines
3.1 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=";
};
patches = [
# Remove after upstream updates to Yarn 4.14
# https://github.com/Awesome-Technologies/synapse-admin/blob/master/package.json#L13
./yarn-4.14-support.patch
];
# we cannot use fetchYarnDeps because that doesn't support yarn 2/berry lockfiles
yarnOfflineCache = stdenv.mkDerivation {
pname = "yarn-deps";
inherit (finalAttrs) version src patches;
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"
"aarch64-darwin"
];
maintainers = with lib.maintainers; [
mkg20001
ma27
];
};
})