docs: initialize NixOS infrastructure with AI assistant

Creates PROJECT.md with vision and requirements.
Creates config.json with interactive workflow mode.
This commit is contained in:
2026-01-01 01:36:58 -05:00
parent 1210a44ecc
commit b54760f62b
8 changed files with 258 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
{ config, lib, pkgs, ... }:
with lib;
{
options.services.myDockerStacks = mkOption {
type = types.attrsOf (types.submodule {
options = {
path = mkOption { type = types.path; };
ports = mkOption { type = types.listOf types.int; default = []; };
};
});
default = {};
description = "Attribute set of docker-compose stacks to run.";
};
config = {
# Generate the systemd services based on the options provided above
systemd.services = mapAttrs' (name: value: nameValuePair "${name}_stack" {
description = "${name} via Docker Compose";
after = [ "network-online.target" "docker.service" ];
wants = [ "network-online.target" "docker.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
WorkingDirectory = value.path;
ExecStartPre = "${pkgs.docker-compose}/bin/docker-compose down";
ExecStart = "${pkgs.docker-compose}/bin/docker-compose up -d";
ExecStop = "${pkgs.docker-compose}/bin/docker-compose down";
RemainAfterExit = true;
};
}) config.services.myDockerStacks;
# Automatically open firewall ports
networking.firewall.allowedTCPPorts = flatten (mapAttrsToList (n: v: v.ports) config.services.myDockerStacks);
};
}