blumeops/containers/ntfy/default.nix
Erich Blume d1dac0c241
All checks were successful
Build Container (Nix) / detect (push) Successful in 1s
Build Container / detect (push) Successful in 3s
Build Container (Nix) / build (ntfy) (push) Successful in 4s
Build Container / build (ntfy) (push) Successful in 11s
Upgrade ntfy v2.17.0 → v2.19.2 (#305)
## Summary
- Upgrade ntfy from v2.17.0 to v2.19.2
- Update Dockerfile and Nix build definitions with new version, commit SHA, and hashes
- Add `subPackages = [ "." ]` to Nix build to handle new `tools/loadtest` module in upstream

## Upstream changes (no breaking changes)
- **v2.18.0:** Experimental PostgreSQL backend support
- **v2.19.0:** PostgreSQL read replica support, notification sound throttling
- **v2.19.1-2:** PostgreSQL bug fixes, web push race condition fix

## Test plan
- [ ] Container builds complete on Forgejo Actions (both Dockerfile and Nix)
- [ ] Update kustomization.yaml `newTag` to the built nix image tag
- [ ] `argocd app set ntfy --revision upgrade/ntfy-v2.19.2 && argocd app sync ntfy`
- [ ] Verify ntfy health: `curl https://ntfy.ops.eblu.me/v1/health`
- [ ] Send a test notification

Reviewed-on: #305
2026-03-23 10:32:06 -07:00

89 lines
1.9 KiB
Nix

# Nix-built ntfy push notification server
# Builds v2.19.2 from forge mirror
# Built with dockerTools.buildLayeredImage for efficient layer caching
{ pkgs ? import <nixpkgs> { } }:
let
version = "2.19.2";
src = pkgs.fetchgit {
url = "https://forge.ops.eblu.me/mirrors/ntfy.git";
rev = "v${version}";
hash = "sha256-HISQnb6LkKGujZsWCzVD3dTuobhUXqrmTFuov7dU+lY=";
};
ui = pkgs.buildNpmPackage {
inherit src version;
pname = "ntfy-sh-ui";
npmDepsHash = "sha256-PmhWzktybM6Cg7yYRfbxWE83C+XkmHh4garHhsydwwE=";
prePatch = ''
cd web/
'';
installPhase = ''
runHook preInstall
mv build/index.html build/app.html
rm build/config.js
mkdir -p $out
mv build/ $out/site
runHook postInstall
'';
};
ntfy = pkgs.buildGoModule {
inherit src version;
pname = "ntfy-sh";
vendorHash = "sha256-mr2PbxT5QWf4HZGgUg+oUjauqmZ6bh6N3f0ytwPDppU=";
doCheck = false;
subPackages = [ "." ];
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
];
postPatch = ''
sed -i 's# /bin/echo# echo#' Makefile
'';
# Copy pre-built web UI; skip docs (create placeholder for go:embed)
preBuild = ''
cp -r ${ui}/site/ server/
mkdir -p server/docs && touch server/docs/placeholder
'';
meta = with pkgs.lib; {
description = "Send push notifications to your phone or desktop via PUT/POST";
homepage = "https://ntfy.sh";
license = licenses.asl20;
mainProgram = "ntfy";
};
};
in
pkgs.dockerTools.buildLayeredImage {
name = "blumeops/ntfy";
tag = "latest";
contents = [
ntfy
pkgs.cacert
pkgs.tzdata
];
config = {
Entrypoint = [ "${ntfy}/bin/ntfy" ];
Env = [
"SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"
"TZDIR=${pkgs.tzdata}/share/zoneinfo"
];
ExposedPorts = {
"80/tcp" = { };
};
User = "65534";
};
}