refactoring hosts too big
This commit is contained in:
1 parent
da102d5b47
commit
b5bde292d2
112 files changed
+2270
-1625
No files matched your search
+54
-1
@@ -33,11 +33,17 @@ skyg os switch / test / build
|
||||
skyg remote switch / test / build / boot / install
|
||||
skyg hm switch / build
|
||||
nix build
|
||||
nix flake check
|
||||
docker/podman build
|
||||
nixos-anywhere
|
||||
```
|
||||
|
||||
The only exception is lightweight operations like
|
||||
|
||||
```
|
||||
nh os switch --dry
|
||||
nix flake check
|
||||
```
|
||||
|
||||
**Why:**
|
||||
|
||||
- These commands take 20–40+ minutes
|
||||
@@ -82,6 +88,29 @@ breaks the composition model.
|
||||
You must **live and die by these rules** and hold yourself accountable to them.
|
||||
These are not suggestions — they are non-negotiable.
|
||||
|
||||
### ❌ NEVER edit files inside `hosts/*/hardware-configuration/`
|
||||
|
||||
These are generated by `nixos-generate-config` and split into `boot.nix` / `file-system.nix`.
|
||||
They reflect physical hardware — edits will be overwritten and can render a system unbootable.
|
||||
The `# Clanker ! Do not modify this file!` header is not a suggestion.
|
||||
|
||||
### ❌ NEVER add top-level config to a host's `default.nix` that belongs in a sub-file
|
||||
|
||||
Every host folder follows a standard layout. Put config in the file that matches its scope:
|
||||
|
||||
| Config type | File |
|
||||
| --------------------- | ------------------------- |
|
||||
| Hardware / firmware | `hardware.nix` |
|
||||
| Systemd / boot loader | `systemd.nix` |
|
||||
| Packages | `packages.nix` |
|
||||
| Networking / firewall | `networking.nix` |
|
||||
| Services (few) | `services.nix` |
|
||||
| Services (many) | `services/<name>.nix` |
|
||||
| Home-manager | `home/default.nix` |
|
||||
| Generated hardware | `hardware-configuration/` |
|
||||
|
||||
Don't dump unrelated options into `default.nix` — split them into the right file.
|
||||
|
||||
### KEEP EVERYTHING CONCISE, shorter concise comments are preferable, less jargon and more common words.
|
||||
|
||||
---
|
||||
@@ -129,6 +158,30 @@ myOptions.desktop.enable = true;
|
||||
All modules follow `lib.mkIf cfg.enable { ... }`. Always gate config behind an `enable`
|
||||
option. Default should be `false` unless the feature is universally required.
|
||||
|
||||
### Host File Structure
|
||||
|
||||
Each host is a folder under `hosts/<hostname>/`. The folder must contain at minimum
|
||||
a `default.nix`. Split larger hosts into focused files:
|
||||
|
||||
```
|
||||
hosts/<hostname>/
|
||||
├── default.nix # skyg options, top-level settings, display manager
|
||||
├── hardware.nix # Host-specific hardware (fwupd, kernel params, firmware)
|
||||
├── systemd.nix # Boot loader, systemd targets/services, tmp, swap
|
||||
├── packages.nix # environment.systemPackages (extract when > ~10 packages)
|
||||
├── services.nix # Flat service configs (when < ~3 services)
|
||||
├── services/
|
||||
│ ├── default.nix # imports all service files
|
||||
│ ├── <service>.nix # One file per service (when > ~3 services)
|
||||
├── networking.nix # Firewall, Tailscale, NFS mounts, hosts
|
||||
├── home/
|
||||
│ └── default.nix # home-manager users.<name> block
|
||||
└── hardware-configuration/ # Generated — DO NOT TOUCH
|
||||
├── default.nix
|
||||
├── boot.nix
|
||||
└── file-system.nix
|
||||
```
|
||||
|
||||
### Host Files vs Shared Modules
|
||||
|
||||
- **Host-specific** (one machine only): goes in `hosts/<hostname>.nix`
|
||||
|
||||
Reference in new issue
Block a user