Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3648b4d535 | |||
| 5a031b48ed | |||
| 47245b2b96 | |||
| c04bce06b6 |
9 changed files with 165 additions and 9 deletions
13
.agent/rules/ci-cd-networking-constraints.md
Normal file
13
.agent/rules/ci-cd-networking-constraints.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
name: cicd-networking
|
||||
description: Networking constraints for CI/CD workflow files (Gitea/GitHub Actions).
|
||||
globs: [".github/workflows/.yml", ".github/workflows/.yaml", ".gitea/workflows/.yml", ".gitea/workflows/.yaml"]
|
||||
---
|
||||
|
||||
# Bos55 CI/CD Networking Constraints
|
||||
|
||||
When generating or modifying CI/CD workflows, strictly follow these networking practices:
|
||||
|
||||
1. **IP-Based Login for Reliability**
|
||||
- When CI runners (like Gitea Actions) need to interact with internal services for authentication or deployment, always use direct IP addresses (e.g., `192.168.0.25`) for machine-to-machine login steps.
|
||||
- **Why?** This bypasses potential DNS resolution issues or delays within the isolated runner environment, ensuring maximum robustness during automated CI/CD runs.
|
||||
14
.agent/rules/dns-management.md
Normal file
14
.agent/rules/dns-management.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
name: dns-management
|
||||
description: Hard constraints for modifying Bind9 DNS zone files.
|
||||
globs: ["db.", ".zone"]
|
||||
---
|
||||
|
||||
# Bos55 DNS Management Constraints
|
||||
|
||||
When modifying or generating Bind9 zone files, you MUST strictly adhere to the following rules:
|
||||
|
||||
1. **Serial Increment (CRITICAL)**
|
||||
- Every single time you modify a Bind9 zone file (e.g., `db.depeuter.dev`), you MUST increment the Serial number in the SOA record. Failure to do so will cause DNS propagation to fail.
|
||||
2. **Domain Name Specificity**
|
||||
- Prefer a single, well-defined explicit domain (e.g., `nix-cache.depeuter.dev`) instead of creating multiple aliases or using magic values. Keep records clean and explicit.
|
||||
21
.agent/rules/git-workflow.md
Normal file
21
.agent/rules/git-workflow.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
name: git-workflow
|
||||
description: Rules for generating Git commit messages and managing branch workflows.
|
||||
globs: ["COMMIT_EDITMSG", ".git/*"]
|
||||
---
|
||||
|
||||
# Git Workflow Constraints
|
||||
|
||||
When generating commit messages, reviewing code for a commit, or planning a branch workflow, strictly follow these standards:
|
||||
|
||||
1. **Commit Formatting**
|
||||
- **Conventional Commits**: You MUST format all commit messages using conventional prefixes: `feat:`, `fix:`, `docs:`, `refactor:`, `ci:`, `meta:`.
|
||||
- **Clarity**: Ensure the message clearly explains *what* changed and *why*.
|
||||
2. **Atomic Commits**
|
||||
- Group changes by a single logical concern.
|
||||
- NEVER mix documentation updates, core infrastructure code, and style guide changes in the same commit.
|
||||
- Ensure that the generated commit is easily revertible without breaking unrelated features.
|
||||
3. **Branching Workflow**
|
||||
- Always assume changes will be pushed to a feature branch to create a Pull Request.
|
||||
- Do not suggest or generate commands that push directly to the main branch.
|
||||
|
||||
47
.agent/skills/nixos-architecture/SKILL.md
Normal file
47
.agent/skills/nixos-architecture/SKILL.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
---
|
||||
name: bos55-nix-architecture
|
||||
description: Implementation patterns for NixOS configurations, networking, and service modules.
|
||||
globs: [".nix", "hosts/**/", "modules//*", "secrets//*"]
|
||||
---
|
||||
|
||||
# NixOS Architecture Skill
|
||||
|
||||
When generating or modifying NixOS configuration files for the Bos55 project, strictly adhere to the following architectural patterns:
|
||||
|
||||
## 1. Minimal Hardcoding & Dynamic Discovery
|
||||
|
||||
- **Local IP Ownership**: Define IPv4/IPv6 addresses **only** within their respective host configuration files (e.g., `hosts/<HostName>/default.nix`). Do not use global IP mapping modules.
|
||||
- **Inter-Host Discovery**: Resolve a host's IP or port by evaluating its configuration at build time. Never hardcode another host's IP.
|
||||
**Pattern Example**:
|
||||
```
|
||||
let
|
||||
bcConfig = inputs.self.nixosConfigurations.BinaryCache.config;
|
||||
bcIp = (pkgs.lib.head bcConfig.networking.interfaces.ens18.ipv4.addresses).address;
|
||||
in "http://${bcIp}:8080"
|
||||
```
|
||||
- **Unified Variables**: Use local variables (e.g., `let dbName = "attic"; in ...`) for shared values between host services and containers to ensure consistency.
|
||||
|
||||
## 2. Modular Service Encapsulation
|
||||
|
||||
- **Self-Contained Modules**: Service modules (`modules/services/<service>/default.nix`) must manage their own configurations. Prefer `lib.mkOption` over hardcoded strings for domains, ports, and credentials.
|
||||
- **Firewall Responsibility**: Open ports (e.g., TCP 8080, SSH 22) directly within the service module based on its own options. Do not open service ports manually in host files.
|
||||
- **Remote Builders**: Define `nix.settings.trusted-users`, `builder` user, and SSH rules directly within the service module if it supports remote building (e.g., Attic).
|
||||
|
||||
## 3. Networking & Connectivity
|
||||
|
||||
- **Container-to-Host**: Host services must connect to companion containers using the container name, not the bridge IP or `localhost`.
|
||||
- **Host Resolution**: Map the container name to `127.0.0.1` using `networking.extraHosts` in the host service module to route traffic seamlessly.
|
||||
- **Domain Deferral**: Client modules must defer their default domain settings to the server module's defined domain option.
|
||||
|
||||
## 4. Secrets Management
|
||||
|
||||
- **Sops-Nix Exclusivity**: Manage all secrets via `sops-nix`.
|
||||
- **Centralized Config**: Rely on `modules/common/default.nix` for fleet-wide settings like `defaultSopsFile` and `age.keyFile`.
|
||||
- **References**: Always reference credentials dynamically using `config.sops.secrets."path/to/secret".path`.
|
||||
|
||||
## 5. Security & Documentation
|
||||
|
||||
- **Supply Chain Protection**: Always verify and lock Nix flake inputs. Use fixed-output derivations for external resource downloads.
|
||||
- **Assumptions Documentation**: Clearly document environment assumptions (e.g., Proxmox virtualization, Tailscale networking, and specific IP ranges) in host or service READMEs.
|
||||
- **Project Structure**: Maintain the strict separation of `hosts/`, `modules/`, `users/`, and `secrets/` to ensure clear ownership and security boundaries.
|
||||
|
||||
43
.github/workflows/build.yml
vendored
Normal file
43
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: "Build"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
determine-hosts:
|
||||
name: "Determining hosts to build"
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-24.04
|
||||
outputs:
|
||||
hosts: ${{ steps.hosts.outputs.hostnames }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: https://github.com/cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: "Determine hosts"
|
||||
id: hosts
|
||||
run: |
|
||||
hostnames="$(nix eval .#nixosConfigurations --apply builtins.attrNames --json)"
|
||||
printf "hostnames=%s\n" "${hostnames}" >> "${GITHUB_OUTPUT}"
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: catthehacker/ubuntu:act-24.04
|
||||
needs: determine-hosts
|
||||
strategy:
|
||||
matrix:
|
||||
hostname: [
|
||||
Development,
|
||||
Testing
|
||||
]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: https://github.com/cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: "Build host"
|
||||
run: |
|
||||
nix build ".#nixosConfigurations.${{ matrix.hostname }}.config.system.build.toplevel" --verbose
|
||||
|
||||
17
.github/workflows/test.yml
vendored
Normal file
17
.github/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
name: "Test"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
jobs:
|
||||
tests:
|
||||
if: false
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: https://github.com/cachix/install-nix-action@v31
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- name: "My custom step"
|
||||
run: nix run nixpkgs#hello
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
.idea
|
||||
result
|
||||
|
|
|
|||
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -20,11 +20,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1760524057,
|
||||
"narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=",
|
||||
"lastModified": 1772624091,
|
||||
"narHash": "sha256-QKyJ0QGWBn6r0invrMAK8dmJoBYWoOWy7lN+UHzW1jc=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5",
|
||||
"rev": "80bdc1e5ce51f56b19791b52b2901187931f5353",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -48,11 +48,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1760393368,
|
||||
"narHash": "sha256-8mN3kqyqa2PKY0wwZ2UmMEYMcxvNTwLaOrrDsw6Qi4E=",
|
||||
"lastModified": 1772495394,
|
||||
"narHash": "sha256-hmIvE/slLKEFKNEJz27IZ8BKlAaZDcjIHmkZ7GCEjfw=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "ab8d56e85b8be14cff9d93735951e30c3e86a437",
|
||||
"rev": "1d9b98a29a45abe9c4d3174bd36de9f28755e3ff",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ in {
|
|||
description = "Vaultwarden WebUI port";
|
||||
};
|
||||
domain = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
type = lib.types.str;
|
||||
example = "https://vault.depeuter.dev";
|
||||
description = "Domain to configure Vaultwarden on";
|
||||
};
|
||||
name = lib.mkOption {
|
||||
type = lib.types.string;
|
||||
type = lib.types.str;
|
||||
example = "Hugo's Vault";
|
||||
description = "Service name to use for invitations and mail";
|
||||
};
|
||||
|
|
@ -77,7 +77,7 @@ in {
|
|||
dataDir = "/data";
|
||||
in {
|
||||
hostname = "vaultwarden";
|
||||
image = "vaultwarden/server:1.34.3-alpine";
|
||||
image = "vaultwarden/server:1.35.4-alpine";
|
||||
autoStart = true;
|
||||
ports = [
|
||||
"${toString cfg.port}:80/tcp"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue