refactor: den-native config, tunnel quirk, per-module inputs

This commit is contained in:
4DBug committed 2026-10-16 07:45:16 -05:00
1 parent 0431bce152
commit bfbac8b961
100 files changed
+668 -1417

No files matched your search

+49 -8
View File
@@ -12,14 +12,57 @@ modules are automatically discovered via [import-tree](https://github.com/vic/im
```
modules/
├── core/ # System fundamentals (desktop, audio, graphics, network, theme)
├── hosts/ # Per-machine includes (nix, styx, box)
├── infra/ # Infrastructure (syncthing, cloudflared tunnels)
├── services/ # Self-hosted services (searxng, gitea, copyparty, ...)
├── software/ # User software (firefox, nixcord, beets, ...)
└── users/ # User accounts
├── system/ # OS fundamentals (base, desktop, audio, graphics, network, theme, janitor, ...)
├── services/ # self-hosted services (searxng, gitea, copyparty, cloudflared, ...)
├── software/<cat>/ # user software; each folder is one aspect: every file (one per software) adds to den.aspects.software.<cat>
├── software/<cat>.nix # single-file categories are flattened to one file
├── roles.nix # den.aspects.desktop / den.aspects.server bundles
├── hosts/
│ ├── default.nix # den.default (every host)
│ ├── common.nix # shared host attrs (domain, bug user), den.homes, schema
│ └── <host>.nix # den.hosts entity + den.aspects.<host>
└── users/ # user accounts
```
aspects are nested by path, e.g. `den.aspects.software.browsers`, `den.aspects.system.network.dns`.
- **den.default** (`hosts/default.nix`) is applied to every host automatically — no need to include it. It also reaches standalone `den.homes`, so host-only aspects (catppuccin, janitor) are wrapped in a `({ host, ... }: ...)` include.
- **host attrs** (`hosts/common.nix` shared, `hosts/<host>.nix` per host): `domain`, `users`, optional `cloudflared = { uuid; protocol; }`. Read them in aspects via `{ host, ... }`.
- **unfree** is allowed per aspect: `includes = [ (den.batteries.unfree [ "steam" ]) ];`.
### adding an app
drop a file in `modules/software/<cat>/` (or edit `modules/software/<cat>.nix`; turn it into a folder once it holds 2+ files) contributing to `den.aspects.software.<cat>` (new category: also add it to `roles.nix`).
### adding a flake input
`flake.nix` is generated by [flake-file](https://github.com/vic/flake-file) — don't edit it. declare the input in the module that uses it:
```nix
{ inputs, ... }: {
flake-file.inputs.foo = {
url = "github:owner/foo";
inputs.nixpkgs.follows = "nixpkgs";
};
den.aspects.software.cli.nixos.imports = [ inputs.foo.nixosModules.default ];
}
```
then run `nix run .#write-flake` (and `nix flake lock`). core inputs (den, flake-parts, nixpkgs, home-manager, ...) live in `modules/den.nix`.
### adding a hosted service
declare a `tunnel` quirk on the aspect; `services.cloudflared` collects them into ingress rules for `<subdomain>.<host.domain>`:
```nix
den.aspects.services.foo = let port = 8080; in {
tunnel = { subdomain = "foo"; inherit port; }; # or a list of them
nixos.services.foo = { enable = true; inherit port; };
};
```
then include `services.foo` (and `services.cloudflared`) in the host, which needs `cloudflared.uuid` set in `modules/hosts/<host>.nix`.
---
## hosts
@@ -39,7 +82,6 @@ all services on `box` are proxied through cloudflared tunnels to `*.bug.tools`.
| Service | URL | Description |
|---------|-----|-------------|
| [searxng](https://github.com/searxng/searxng) | [search.bug.tools](https://search.bug.tools) | Privacy-respecting metasearch engine |
| [redlib](https://github.com/redlib-org/redlib) | [reddit.bug.tools](https://reddit.bug.tools) | Private Reddit frontend *(disabled)* |
| [copyparty](https://github.com/9001/copyparty) | [files.bug.tools](https://files.bug.tools) | File server / uploader |
| [gitea](https://gitea.io/) | [git.bug.tools](https://git.bug.tools) | Self-hosted Git with org mirrors |
| [glances](https://github.com/nicolargo/glances) | [monitor.bug.tools](https://monitor.bug.tools) | System monitoring |
@@ -71,5 +113,4 @@ all services on `box` are proxied through cloudflared tunnels to `*.bug.tools`.
## TODO
fix matrix server
fix invidious instance
fix redlib instance
configure cosmic with home