nixos-config/packages/matrix/sliding-sync/default.nix

38 lines
1 KiB
Nix
Raw Normal View History

{
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
2024-04-27 05:52:54 +00:00
SRC_PATH=$(nix-build -E '(import ../.).packages.x86_64-linux.${pname}.src')
${../../scripts/update-go.sh} $SRC_PATH matrix/sliding-sync/
fi
'';
}