services: add mealie

This commit is contained in:
Antoine Martin 2024-07-03 20:27:35 +02:00
parent 59f24701a3
commit dedbbed14b
2 changed files with 56 additions and 0 deletions

View file

@ -9,6 +9,7 @@
./jellyfin.nix ./jellyfin.nix
./lohr.nix ./lohr.nix
./matrix.nix ./matrix.nix
./mealie.nix
./media.nix ./media.nix
./microbin.nix ./microbin.nix
./miniflux.nix ./miniflux.nix

55
services/mealie.nix Normal file
View file

@ -0,0 +1,55 @@
{
config,
lib,
pkgs,
...
}: let
inherit
(lib)
mkEnableOption
mkIf
mkOption
;
cfg = config.my.services.mealie;
my = config.my;
domain = config.networking.domain;
hostname = config.networking.hostName;
fqdn = "${hostname}.${domain}";
in {
options.my.services.mealie = let
inherit (lib) types;
in {
enable = mkEnableOption "Mealie";
port = mkOption {
type = types.port;
example = 8080;
description = "Internal port for Mealie webapp";
};
};
config = mkIf cfg.enable {
services.mealie = {
enable = true;
listenAddress = "127.0.0.1";
port = cfg.port;
};
services.nginx.virtualHosts."mealie.${domain}" = {
forceSSL = true;
useACMEHost = fqdn;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString cfg.port}/";
proxyWebsockets = true;
};
};
security.acme.certs.${fqdn}.extraDomainNames = ["mealie.${domain}"];
my.services.restic-backup = {
paths = ["/var/lib/mealie"];
};
};
}