nix
my nixos configuration, structured with den and flake-parts.
structure
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
modules are automatically discovered via import-tree and composed using den.aspects.
modules/
├── 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 standaloneden.homes, so host-only aspects (catppuccin, janitor) are wrapped in a({ host, ... }: ...)include. - host attrs (
hosts/common.nixshared,hosts/<host>.nixper host):domain,users, optionalcloudflared = { 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 — don't edit it. declare the input in the module that uses it:
{ 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>:
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
| Host | Role | GPU | Switch Command |
|---|---|---|---|
nix |
desktop | nvidia | nh os switch ~/nix --impure -H nix |
styx |
laptop | amd | nh os switch ~/nix --impure -H styx |
box |
homeserver | — | nh os switch ~/nix --impure -H box |
self-hosted services
all services on box are proxied through cloudflared tunnels to *.bug.tools.
| Service | URL | Description |
|---|---|---|
| searxng | search.bug.tools | Privacy-respecting metasearch engine |
| copyparty | files.bug.tools | File server / uploader |
| gitea | git.bug.tools | Self-hosted Git with org mirrors |
| glances | monitor.bug.tools | System monitoring |
| nixos-mailserver | mail.bug.tools | Email server |
| invidious | tube.bug.tools | YouTube frontend (disabled) |
| matrix | matrix.bug.tools | Matrix homeserver (disabled) |
| sish | tuns.bug.tools | SSH tunnels (disabled) |
| vscode-server | — | Remote VS Code access |
flake inputs
| Input | Purpose |
|---|---|
| nixpkgs (unstable) | Package set |
| home-manager | User environment management |
| flake-parts | Flake structure |
| den | Dendritic aspect system |
| import-tree | Auto module discovery |
| stylix | System-wide theming |
| catppuccin/nix | Catppuccin theme modules |
| nixcord | Declarative Vesktop/Discord |
| nix-flatpak | Declarative Flatpak |
| copyparty | File server |
TODO
fix matrix server fix invidious instance configure cosmic with home