Package ntfy-sh as NixNG image

This commit is contained in:
Pim Kunis 2024-12-14 21:43:55 +01:00
parent 23e8146077
commit a741e523a0
5 changed files with 42 additions and 28 deletions

View file

@ -13,6 +13,7 @@ Legend:
| --- | --- | --- |
| ✨ | `nixng-dnsmasq` | |
| ✨ | `nixng-attic` | |
| ✨ | `nixng-ntfy-sh` | |
| ✨ | `git.kun.is/home/blog-pim` | |
| ✅ | `jellyfin/jellyfin` | |
| ✅ | `linuxserver/deluge` | |
@ -39,7 +40,6 @@ Legend:
| ✅ | `freshrss/freshrss` | |
| ✅ | `ubuntu/bind9` | |
| ✅ | `quay.io/hedgedoc/hedgedoc` | |
| ✅ | `binwiederhier/ntfy` | |
| 🫤 | `itzg/minecraft-server` | |
| 🫤 | `teddysun/kms` | |
| 🫤 | `tomsquest/docker-radicale` | |

View file

@ -595,15 +595,16 @@
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1734101800,
"narHash": "sha256-wqEGpgd8bya9giHzrBKjlqUOEvaWr5nrbXqn4d8/q3E=",
"owner": "nix-community",
"lastModified": 1734195137,
"narHash": "sha256-BO6DzwWe2U8FHSxavnFzKHZgobHf2ejI8uu9/AhbHtY=",
"owner": "pizzapim",
"repo": "NixNG",
"rev": "45fc112f5c22ad109a80aa153d7d0e00c06503c9",
"rev": "b173ab68cbde3395edda3594d63de4de764f4934",
"type": "github"
},
"original": {
"owner": "nix-community",
"owner": "pizzapim",
"ref": "ntfy-sh",
"repo": "NixNG",
"type": "github"
}

View file

@ -41,7 +41,7 @@
};
nixng = {
url = "github:nix-community/NixNG";
url = "github:pizzapim/NixNG/ntfy-sh";
inputs.nixpkgs.follows = "nixpkgs";
};
};

31
images/ntfy-sh.nix Normal file
View file

@ -0,0 +1,31 @@
{
nglib,
nixpkgs,
...
}:
nglib.makeSystem {
inherit nixpkgs;
system = "x86_64-linux";
name = "nixng-ntfy-sh";
config = {...}: {
dinit.enable = true;
init.services.ntfy-sh.shutdownOnExit = true;
services.ntfy-sh = {
enable = true;
settings = {
base-url = "https://ntfy.kun.is";
cache-file = "/var/cache/ntfy/cache.db";
cache-duration = "14d";
auth-file = "/var/lib/ntfy/user.db";
auth-default-access = "deny-all";
attachment-cache-dir = "/var/cache/ntfy-attachments";
enable-signup = false;
enable-login = true;
visitor-subscription-limit = 100;
};
};
};
}

View file

@ -1,25 +1,14 @@
{
lib,
config,
globals,
utils,
self,
...
}: {
options.ntfy.enable = lib.mkEnableOption "ntfy";
config = lib.mkIf config.ntfy.enable {
kubernetes.resources = {
configMaps.ntfy.data.config = lib.generators.toYAML {} {
base-url = "https://ntfy.kun.is";
cache-file = "/var/cache/ntfy/cache.db";
cache-duration = "14d";
auth-file = "/var/lib/ntfy/user.db";
auth-default-access = "deny-all";
attachment-cache-dir = "/var/cache/ntfy-attachments";
enable-signup = false;
enable-login = true;
visitor-subscription-limit = 100;
};
deployments.ntfy.spec = {
selector.matchLabels.app = "ntfy";
@ -37,10 +26,9 @@
spec = {
containers.ntfy = {
image = globals.images.ntfy;
image = utils.nixSnapshotterRef (utils.mkNixNGImage "ntfy-sh" "${self}/images/ntfy-sh.nix");
ports.web.containerPort = 80;
env.TZ.value = "Europe/Amsterdam";
args = ["serve"];
volumeMounts = [
{
@ -55,11 +43,6 @@
name = "attachment-cache";
mountPath = "/var/cache/ntfy-attachments";
}
{
name = "config";
mountPath = "/etc/ntfy/server.yml";
subPath = "config";
}
];
};
@ -67,7 +50,6 @@
cache.persistentVolumeClaim.claimName = "cache";
attachment-cache.persistentVolumeClaim.claimName = "attachment-cache";
data.persistentVolumeClaim.claimName = "data";
config.configMap.name = "ntfy";
};
};
};