Fix flake update (#11)
diff-tag / dix (push) Successful in 6m33s
flake-check / flake-check (push) Successful in 59s
lint / lint (push) Successful in 1m47s

Co-authored-by: flowey <floweydev@gmail.com>
Co-authored-by: gitea-actions[bot] <gitea-actions@noreply.local>
Reviewed-on: #11
This commit was merged in pull request #11.
This commit is contained in:
2026-09-22 21:44:25 +00:00
co-authored by flowey gitea-actions[bot]
parent 8551b8ad90
commit d9b4bab1f8
10 changed files with 329 additions and 296 deletions
+38 -43
View File
@@ -7,7 +7,7 @@
...
}:
let
inherit (dsl) mkContainer;
inherit (dsl) mkContainer collectContainers;
inherit (hostInfo.paths) data;
mkNginxConfig =
@@ -40,9 +40,6 @@ let
defaultLoc = lib.optionalAttrs (upstream != null) {
"/" = {
proxyWebsockets = websockets;
# avoid startup error when containers aren't registered yet
# proxyPass is left unset for that reason, so recommendedProxySettings
# won't auto-include its headers here - set them manually to match
extraConfig = ''
set $backend "${upstream.container.name}:${toString upstream.port}";
proxy_pass http://$backend;
@@ -157,49 +154,46 @@ let
up = container: port: { inherit container port; };
nginxSetup =
hostAddr:
mkNginxConfig {
email = "floweydev@gmail.com";
resolver = hostAddr;
vhosts = [
{
domain = "devenv.floweytf.com";
upstream = up containers.devenv 8080;
}
{
domain = "maven.floweytf.com";
upstream = up containers.maven 8080;
}
{
domain = "git.floweytf.com";
upstream = up containers.git 3000;
}
{
domain = "utils.floweytf.com";
redirect = false;
listenHttp = true;
extraLocations = {
"/static/" = {
alias = "/usr/share/nginx/static/";
extraConfig = "autoindex on;";
};
};
}
{
# no upstream, vhost only exists for certs
domain = "mail.floweytf.com";
}
];
};
in
let
setup = nginxSetup hostAddr;
discovered = collectContainers "nginx" containers;
discoveredVhosts = map (
{ container, data }:
{
inherit (data) domain;
}
// lib.optionalAttrs (data ? port) { upstream = up container data.port; }
// lib.optionalAttrs (data ? websockets) { inherit (data) websockets; }
// lib.optionalAttrs (data ? redirect) { inherit (data) redirect; }
// lib.optionalAttrs (data ? listenHttp) { inherit (data) listenHttp; }
// lib.optionalAttrs (data ? extraLocations) { inherit (data) extraLocations; }
) discovered;
extraVhosts = [
{
domain = "utils.floweytf.com";
redirect = false;
listenHttp = true;
extraLocations = {
"/static/" = {
alias = "/usr/share/nginx/static/";
extraConfig = "autoindex on;";
};
};
}
];
upstreamContainers = map (e: e.container) (lib.filter ({ data, ... }: data ? port) discovered);
setup = mkNginxConfig {
email = "floweydev@gmail.com";
resolver = hostAddr;
vhosts = discoveredVhosts ++ extraVhosts;
};
c = mkContainer {
inherit name;
net.access = setup.access ++ [ { to = "@internet"; } ];
svc.autoStart = true;
svc.depends = lib.attrVals [ "devenv" "maven" "git" ] containers;
svc.depends = upstreamContainers;
net.forward.tcp = [
80
443
@@ -208,6 +202,7 @@ let
hostPath = "${data}/core/nginx/acme";
isReadOnly = false;
};
miscProperties.acmeDomains = map (v: v.domain) (discoveredVhosts ++ extraVhosts);
inherit (setup) containerConfig;
};
inherit (c) hostAddr;