This repository has been archived on 2024-10-13. You can view files and clone it, but cannot push or open issues or pull requests.
nix-packages/matrix/sliding-sync/default.nix

37 lines
1 KiB
Nix

{
buildGoApplication,
olm,
fetchFromGitHub,
lib,
writeScript,
go,
}: let
source = builtins.fromJSON (builtins.readFile ./source.json);
in
buildGoApplication rec {
pname = "sliding-sync";
version = source.date;
src = fetchFromGitHub {
owner = "matrix-org";
repo = "sliding-sync";
inherit (source) rev sha256;
};
modules = ./gomod2nix.toml;
buildInputs = [
olm
];
CGO_ENABLED = "1";
doCheck = false;
meta = {
description = "sliding sync proxy";
license = lib.licenses.asl20;
broken = builtins.compareVersions go.version "1.18" < 0;
};
passthru.updateScript = writeScript "update-sliding-sync" ''
${../../scripts/update-git.sh} "https://github.com/matrix-org/sliding-sync" matrix/sliding-sync/source.json
if [ "$(git diff -- matrix/sliding-sync/source.json)" ]; then
SRC_PATH=$(nix-build -E '(import ./. {}).${pname}.src')
${../../scripts/update-go.sh} $SRC_PATH matrix/sliding-sync/
fi
'';
}