nix-module
Create a new NixOS module for the tsurf repo
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new NixOS module for the tsurf repo
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Create or update a private tsurf overlay from discovered host facts. Use when an agent needs to author NixOS modules, choose public tsurf role modules, or preserve private services.
Validate a tsurf public repo or private overlay before deployment. Use when an agent is about to run checks, prepare a deploy, override a deploy target, verify rollback/recovery safety, or decide whether a tsurf host change is safe enough to push.
Inspect an existing or prospective NixOS host before applying tsurf. Use when an agent needs to choose a safe tsurf setup path, adapt to unknown disk/network/provider details, determine whether a host can use the public roles directly, or collect facts for a private overlay.
Deploy tsurf NixOS config to a server
Run tests and manage .test-status for the tsurf repo
| name | nix-module |
| description | Create a new NixOS module for the tsurf repo |
| user_invocable | true |
Create or extend NixOS modules in this repo using tsurf-specific patterns.
modules/<name>.nix@decision annotations for security-relevant choices.{ config, lib, pkgs, ... }:services.dashboard.entries.<name> declaration.let bindings for values referenced more than once.lib.mkDefault for hardening defaults that modules may need to override.Add a dashboard entry and register the port:
services.dashboard.entries.<name> = {
name = "Display Name";
description = "What it does";
port = 8090; # if applicable
icon = "mdi-server";
systemdUnit = "<name>.service";
module = "<name>.nix";
order = 50;
};
Then add the port to internalOnlyPorts in modules/networking.nix:
"8090" = "<name>";
In modules/secrets.nix:
sops.secrets."<name>-token" = { owner = "<name>"; };
sops.templates."<name>-env" = {
content = ''
TOKEN=${config.sops.placeholder."<name>-token"}
'';
};
Then encrypt the real value:
sops secrets/tsurf.yaml
# or
sops secrets/ovh.yaml
In modules/impermanence.nix, add to the directories list:
{ directory = "/var/lib/<name>"; user = "<name>"; group = "<name>"; mode = "0700"; }
Add the module path to hosts/services/default.nix or hosts/dev/default.nix:
../../modules/<name>.nix
git add modules/<name>.nix
nix flake check
Flakes only see tracked files. git add is mandatory before nix flake check.
In tests/eval/config-checks.nix, add a check with mkCheck:
<name>-service-defined = mkCheck
"<name>-service-defined"
"<name> systemd service is defined"
"<name> service missing — check modules/<name>.nix import"
(builtins.hasAttr "<name>" tsurfCfg.systemd.services);
@decision annotations on security-relevant choicesopenFirewall = false for network servicesservices.dashboard.entries.<name> declared and port added to internalOnlyPortsnix flake check passes.test-status updated