added homepage to server

This commit is contained in:
2026-11-16 13:18:10 +00:00
parent d1c54ce3ff
commit 86a52047cd
3 changed files with 99 additions and 4 deletions

View File

@@ -0,0 +1,62 @@
{moduleWithSystem, ...}: {
flake.nixosModules.containerMatrix = moduleWithSystem ({pkgs, ...}: {config, ...}: {
virtualisation.oci-containers.containers."bun-server" = {
image = "oven/bun:latest";
environmentFiles = [config.sops.templates."homepage.env".path];
volumes = [
"/containers/homepage/build:/app/build:rw"
];
ports = [
"5123:3000/tcp"
];
cmd = ["bun" "--hot" "run" "/app/build"];
log-driver = "journald";
extraOptions = [
"--network-alias=bun-server"
"--network=homepage_default"
];
};
systemd.services."podman-bun-server" = {
serviceConfig = {
Restart = pkgs.lib.mkOverride 90 "always";
};
after = [
"podman-network-homepage_default.service"
];
requires = [
"podman-network-homepage_default.service"
];
partOf = [
"podman-compose-homepage-root.target"
];
wantedBy = [
"podman-compose-homepage-root.target"
];
};
# Networks
systemd.services."podman-network-homepage_default" = {
path = [pkgs.podman];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStop = "podman network rm -f homepage_default";
};
script = ''
podman network inspect homepage_default || podman network create homepage_default
'';
partOf = ["podman-compose-homepage-root.target"];
wantedBy = ["podman-compose-homepage-root.target"];
};
# Root service
# When started, this will automatically create all resources and start
# the containers. When stopped, this will teardown all resources.
systemd.targets."podman-compose-homepage-root" = {
unitConfig = {
Description = "Root target generated by compose2nix.";
};
wantedBy = ["multi-user.target"];
};
});
}

View File

@@ -29,6 +29,17 @@
matrix-postgres-password = {};
matrix-livekit-key = {};
matrix-livekit-secret = {};
homepage-jellyfin-url = {};
homepage-jellyfin-api_key = {};
homepage-jellyfin-playlist_id = {};
homepage-jellyfin-user_id = {};
homepage-jellyfin-library_id = {};
homepage-komga-url = {};
homepage-komga-api_key = {};
homepage-komga-library_id = {};
homepage-blog-url = {};
homepage-google-api_key = {};
homepage-channel-id = {};
};
templates = {
"gitea.env".content = ''
@@ -56,6 +67,19 @@
LIVEKIT_KEY=${config.sops.placeholder.matrix-livekit-key}
LIVEKIT_SECRET=${config.sops.placeholder.matrix-livekit-secret}
'';
"homepage.env".content = ''
JELLYFIN_URL=${config.sops.placeholder.homepage-jellyfin-url}
JELLYFIN_API_KEY=${config.sops.placeholder.homepage-jellyfin-api_key}
JELLYFIN_PLAYLIST_ID=${config.sops.placeholder.homepage-jellyfin-playlist_id}
JELLYFIN_USER_ID=${config.sops.placeholder.homepage-jellyfin-user_id}
JELLYFIN_LIBRARY_ID=${config.sops.placeholder.homepage-jellyfin-library_id}
KOMGA_URL=${config.sops.placeholder.homepage-komga-url}
KOMGA_API_KEY=${config.sops.placeholder.homepage-komga-api_key}
KOMGA_LIBRARY_ID=${config.sops.placeholder.homepage-komga-library_id}
BLOG_URL=${config.sops.placeholder.homepage-blog-url}
GOOGLE_API_KEY=${config.sops.placeholder.homepage-google-api_key}
CHANNEL_ID=${config.sops.placeholder.homepage-channel-id}
'';
};
};
};