ntfy-sh: modernize

This commit is contained in:
Franz Pletz 2025-07-11 17:08:24 +02:00
parent d0d653168f
commit 9b2ae092be
No known key found for this signature in database
GPG Key ID: EA0080A44798F201

View File

@ -10,73 +10,82 @@
python3Packages,
}:
buildGoModule rec {
pname = "ntfy-sh";
version = "2.13.0";
buildGoModule (
finalAttrs:
src = fetchFromGitHub {
owner = "binwiederhier";
repo = "ntfy";
tag = "v${version}";
hash = "sha256-D4wLIGVItH5lZlfmgd2+QsqB4PHlyX4ORpwT1NGdV60=";
};
let
ui = buildNpmPackage {
inherit (finalAttrs) src version;
pname = "ntfy-sh-ui";
npmDepsHash = "sha256-oiOv4d+Gxk43gUAZXrTpcsfuEEpGyJMYS19ZRHf9oF8=";
vendorHash = "sha256-7+nvkyLcdQZ/B4Lly4ygcOGxSLkXXqCqu7xvCB4+8Wo=";
prePatch = ''
cd web/
'';
ui = buildNpmPackage {
inherit src version;
pname = "ntfy-sh-ui";
npmDepsHash = "sha256-oiOv4d+Gxk43gUAZXrTpcsfuEEpGyJMYS19ZRHf9oF8=";
installPhase = ''
runHook preInstall
prePatch = ''
cd web/
'';
mv build/index.html build/app.html
rm build/config.js
mkdir -p $out
mv build/ $out/site
installPhase = ''
mv build/index.html build/app.html
rm build/config.js
mkdir -p $out
mv build/ $out/site
'';
};
runHook postInstall
'';
};
in
{
pname = "ntfy-sh";
version = "2.13.0";
doCheck = false;
src = fetchFromGitHub {
owner = "binwiederhier";
repo = "ntfy";
tag = "v${finalAttrs.version}";
hash = "sha256-D4wLIGVItH5lZlfmgd2+QsqB4PHlyX4ORpwT1NGdV60=";
};
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
vendorHash = "sha256-7+nvkyLcdQZ/B4Lly4ygcOGxSLkXXqCqu7xvCB4+8Wo=";
nativeBuildInputs = [
debianutils
mkdocs
python3
python3Packages.mkdocs-material
python3Packages.mkdocs-minify-plugin
];
doCheck = false;
postPatch = ''
sed -i 's# /bin/echo# echo#' Makefile
'';
preBuild = ''
cp -r ${ui}/site/ server/
make docs-build
'';
passthru = {
updateScript = ./update.sh;
tests.ntfy-sh = nixosTests.ntfy-sh;
};
meta = with lib; {
description = "Send push notifications to your phone or desktop via PUT/POST";
homepage = "https://ntfy.sh";
license = licenses.asl20;
maintainers = with maintainers; [
arjan-s
fpletz
ldflags = [
"-s"
"-w"
"-X main.version=${finalAttrs.version}"
];
};
}
nativeBuildInputs = [
debianutils
mkdocs
python3
python3Packages.mkdocs-material
python3Packages.mkdocs-minify-plugin
];
postPatch = ''
sed -i 's# /bin/echo# echo#' Makefile
'';
preBuild = ''
cp -r ${ui}/site/ server/
make docs-build
'';
passthru = {
updateScript = ./update.sh;
tests.ntfy-sh = nixosTests.ntfy-sh;
};
meta = {
description = "Send push notifications to your phone or desktop via PUT/POST";
homepage = "https://ntfy.sh";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [
arjan-s
fpletz
];
};
}
)