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
-54
View File
@@ -1,54 +0,0 @@
{
name,
hostInfo,
dsl,
...
}:
let
inherit (dsl) mkContainer mkService;
inherit (hostInfo.paths) data secrets;
in
mkContainer {
inherit name;
net.access = [ { to = "@internet"; } ];
svc.autoStart = true;
resources.fs = {
"/config" = {
hostPath = "${data}/web/devenv/config";
isReadOnly = false;
};
"/workspace" = {
hostPath = "${data}/web/devenv/workspace";
isReadOnly = false;
};
"/run/secrets/code-server-env" = {
hostPath = "${secrets}/code-server-env";
isReadOnly = true;
};
};
users = [
{
name = "coder";
uid = 1000;
home = "/config";
}
];
service =
{ pkgs, lib, ... }:
mkService {
description = "code-server";
execStart = "${lib.getExe' pkgs.code-server "code-server"} --bind-addr 0.0.0.0:8080 --user-data-dir /config/data --extensions-dir /config/extensions --auth password /workspace";
networkOnline = true;
serviceConfig = {
EnvironmentFile = "/run/secrets/code-server-env";
User = "coder";
ReadWritePaths = [
"/config"
"/workspace"
];
};
};
net.expose.tcp = [ 8080 ];
resources.mem = "4G";
resources.cpu = 2;
}
+6 -1
View File
@@ -53,6 +53,10 @@ in
systemd.services.gitea.serviceConfig.FailureAction = "exit-force";
};
net.expose.tcp = [ 3000 ];
miscProperties.nginx = {
domain = "git.floweytf.com";
port = 3000;
};
};
ci-runner =
@@ -176,8 +180,9 @@ in
PermitEmptyPasswords = "yes";
};
};
security.pam.services.sshd.allowNullPassword = true;
users.users.root.initialHashedPassword = "";
services.journald.extraConfig = "ForwardToConsole=yes";
services.journald.settings.Journal.ForwardToConsole = "yes";
virtualisation.containerd.enable = true;
virtualisation.containerd.settings.plugins."io.containerd.snapshotter.v1.overlayfs".mount_options =
+3
View File
@@ -150,6 +150,9 @@ mkContainer {
net.access = [ { to = "@internet"; } ];
svc.autoStart = true;
miscProperties.nginx = {
domain = "mail.floweytf.com";
};
net.forward.tcp = [
25
993
+4
View File
@@ -38,4 +38,8 @@ mkContainer {
environment.JAVA_OPTS = "-Xmx128M";
};
net.expose.tcp = [ 8080 ];
miscProperties.nginx = {
domain = "maven.floweytf.com";
port = 8080;
};
}
+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;