NixOS/system/podman/memos.nix

50 lines
1.2 KiB
Nix
Raw Normal View History

2024-07-28 22:18:27 +07:00
{ config, lib, ... }:
let
name = "memos";
podman = config.profile.podman;
inherit (lib) mkIf;
ip = "10.88.88.1";
image = "docker.io/neosmemo/memos:stable";
rootVolume = "/nas/podman/memos";
domain = "${name}.tigor.web.id";
user = config.profile.user;
uid = toString user.uid;
gid = toString user.gid;
in
{
config = mkIf (podman.enable && podman.${name}.enable) {
2024-11-24 20:16:30 +07:00
services.nginx.virtualHosts.${domain} = {
useACMEHost = "tigor.web.id";
2024-11-24 20:16:30 +07:00
forceSSL = true;
locations."/".proxyPass = "http://${ip}:5230";
};
security.acme.certs."tigor.web.id".extraDomainNames = [ domain ];
2024-07-28 22:18:27 +07:00
system.activationScripts."podman-${name}" = ''
mkdir -p ${rootVolume}
chown ${uid}:${gid} ${rootVolume}
'';
virtualisation.oci-containers.containers.${name} = {
inherit image;
hostname = name;
autoStart = true;
user = "${uid}:${gid}";
environment = {
TZ = "Asia/Jakarta";
# MEMOS_PUBLIC = "true";
};
volumes = [ "${rootVolume}:/var/opt/memos" ];
2024-07-28 22:18:27 +07:00
extraOptions = [
"--network=podman"
"--ip=${ip}"
];
labels = {
"io.containers.autoupdate" = "registry";
};
};
};
}