2024-10-28 04:10:59 +08:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildGoModule,
|
|
|
|
fetchFromGitHub,
|
|
|
|
versionCheckHook,
|
2025-04-19 03:15:14 +08:00
|
|
|
nix-update-script,
|
2024-10-28 04:10:59 +08:00
|
|
|
}:
|
|
|
|
|
2025-04-19 03:14:50 +08:00
|
|
|
buildGoModule (finalAttrs: {
|
2024-10-28 04:10:59 +08:00
|
|
|
pname = "bark-server";
|
2025-07-23 06:55:12 +00:00
|
|
|
version = "2.2.5";
|
2024-10-28 04:10:59 +08:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Finb";
|
|
|
|
repo = "bark-server";
|
2025-04-19 03:14:50 +08:00
|
|
|
tag = "v${finalAttrs.version}";
|
2025-07-23 06:55:12 +00:00
|
|
|
hash = "sha256-Fe0PXwwVCrvoMTYMoTUkQaT6kVDdGPadFLkTDRhlh5U=";
|
2024-10-28 04:10:59 +08:00
|
|
|
# populate values that require us to use git. By doing this in postFetch we
|
|
|
|
# can delete .git afterwards and maintain better reproducibility of the src.
|
|
|
|
leaveDotGit = true;
|
|
|
|
postFetch = ''
|
|
|
|
cd "$out"
|
|
|
|
git rev-parse HEAD > $out/COMMIT
|
|
|
|
# '0000-00-00T00:00:00Z'
|
|
|
|
date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
|
|
|
|
find "$out" -name .git -print0 | xargs -0 rm -rf
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2025-07-23 06:55:12 +00:00
|
|
|
vendorHash = "sha256-lpRxwCF+3+32FSn5XQ551l2ONtyuA9ewDQgwHgYUnT0=";
|
2024-10-28 04:10:59 +08:00
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
2025-04-19 03:14:50 +08:00
|
|
|
"-X main.version=${finalAttrs.version}"
|
2024-10-28 04:10:59 +08:00
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
2025-04-19 03:13:23 +08:00
|
|
|
ldflags+=" -X \"main.buildDate=$(<SOURCE_DATE_EPOCH)\""
|
|
|
|
ldflags+=" -X main.commitID==$(<COMMIT)"
|
2024-10-28 04:10:59 +08:00
|
|
|
'';
|
|
|
|
|
2025-04-19 03:13:23 +08:00
|
|
|
# All tests require network
|
|
|
|
doCheck = false;
|
|
|
|
|
2024-10-28 04:10:59 +08:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
versionCheckProgramArg = "-v";
|
|
|
|
|
|
|
|
nativeInstallCheckInputs = [
|
|
|
|
versionCheckHook
|
|
|
|
];
|
|
|
|
|
2025-04-19 03:15:14 +08:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2024-10-28 04:10:59 +08:00
|
|
|
meta = {
|
|
|
|
description = "Backend of Bark, an iOS App which allows you to push customed notifications to your iPhone";
|
|
|
|
homepage = "https://github.com/Finb/bark-server";
|
2025-04-19 03:14:50 +08:00
|
|
|
changelog = "https://github.com/Finb/bark-server/releases/tag/v${finalAttrs.version}";
|
2024-10-28 04:10:59 +08:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ moraxyc ];
|
|
|
|
mainProgram = "bark-server";
|
|
|
|
};
|
2025-04-19 03:14:50 +08:00
|
|
|
})
|