feat: add Yami dev stack module (on-demand gitea+postgres+docker+runner) #3
Reference in New Issue
Block a user
Delete Branch "claude/add-yami-dev-stack-zHOMn"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
$(cat <<'EOF'
Summary
yami-dev-stack.nix— on-demand dev-стек для проекта Yami (стриминговый плеер для аниме)yami-up, не стартует при загрузке системыvirtualisation.docker.enable = trueизconfiguration.nix— docker теперь управляется модулемЧто включает модуль
yami-dev.target— ручной запуск всего стека одной командойgitea, socket-аутентификацияenableOnBoot = false, запускается только в составе targetubuntu-latest:docker://node:20иnative:hostyami-up,yami-down,yami-status,yami-logsАктивация
Раскомментировать в
configuration.nix:И добавить:
Затем
sudo nixos-rebuild switch --flake .#chexit.Test plan
nixos-rebuild switchбез ошибокyami-upподнимает Gitea на http://localhost:3000yami-downостанавливает весь стекyami-up)https://claude.ai/code/session_017dm8ypaaWNeA27ctmwq5dn
EOF
)
Pull request overview
Adds an optional NixOS module to spin up an on-demand local development stack for the Yami project (Gitea + PostgreSQL + Docker + Gitea Actions runner) controlled via a dedicated systemd target rather than starting on boot.
Changes:
yami-dev-stack.nixmodule withservices.yami-dev-stack.enable/useroptions and ayami-dev.targetto start/stop the stack manually.configuration.nixto stop enabling Docker globally and to document how to enable the new module.Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Removing
virtualisation.docker.enable = true;makes Docker unavailable unless the yami-dev-stack module is enabled. If Docker is still expected for other workflows on this host, consider leaving Docker enabled here and only controlling its on-demand start in the module, or clearly documenting that enabling yami-dev-stack is now required for any Docker usage.@@ -0,0 +59,4 @@server = {DOMAIN = "localhost";ROOT_URL = "http://localhost:3000/";HTTP_ADDR = "0.0.0.0";Binding the Gitea HTTP server to
0.0.0.0and opening firewall ports makes this dev stack reachable from the network by default. For a local-only on-demand dev stack, prefer binding to127.0.0.1(or make the bind address / openFirewall behavior configurable via module options) to reduce accidental exposure.@@ -0,0 +61,4 @@ROOT_URL = "http://localhost:3000/";HTTP_ADDR = "0.0.0.0";HTTP_PORT = 3000;SSH_PORT = 2222;Gitea built-in SSH server typically listens on
SSH_LISTEN_PORT(default 22); setting onlySSH_PORT = 2222usually affects clone URL display, not the actual bind port. WithSTART_SSH_SERVER = truethis may try to bind to 22 and fail (or require extra privileges). SetSSH_LISTEN_PORT = 2222(and optionallySSH_LISTEN_HOST) alongsideSSH_PORTto ensure it actually listens on 2222.@@ -0,0 +117,4 @@wantedBy = mkForce [ "yami-dev.target" ];partOf = [ "yami-dev.target" ];};For “manual-only” Docker, overriding only
systemd.services.docker.wantedBymay not be sufficient ifdocker.socketis still enabled (socket activation can start dockerd withoutyami-dev.target). Verify whethervirtualisation.docker.enableOnBoot = falsedisables the socket; if not, also adjustsystemd.sockets.docker.wantedBy(or explicitly disable the socket) so Docker can’t start outsideyami-dev.target.@@ -0,0 +119,4 @@};users.users.${cfg.user}.extraGroups = [ "docker" ];users.users.${cfg.user}.extraGroups = [ "docker" ];will create/modify that user entry from this module. Ifcfg.userisn’t already defined elsewhere, this can lead to an invalid/incomplete user definition or unexpected user creation. Consider adding an assertion that the user exists (builtins.hasAttr cfg.user config.users.users) and usemkAfterto append the group instead of redefining the list.@@ -0,0 +126,4 @@name = "home-runner";url = "http://localhost:3000";tokenFile = "/var/lib/gitea-runner/token";labels = [services.gitea-actions-runnerwill fail to start iftokenFiledoesn’t exist yet, which makesyami-uplikely to report a failed unit on first run. Consider adding a systemdConditionPathExists=(or similar gating) forgitea-runner-defaultso the rest of the target can start cleanly before the token is provisioned.