1.6 KiB
1.6 KiB
structure
how the config is organized.
top-level
nix-config/
├── flake.nix # entry point - dispatches to hosts
├── home/ # home-manager (user space)
├── hosts/ # system-level configs
├── secrets/ # sops-nix encrypted files
└── docs/ # this folder
flake.nix flow
flake.nix
├── nixosConfigurations
│ ├── muscari → hosts/muscari/ + home/
│ └── rosemary → hosts/rosemary/ + home/
└── darwinConfigurations
└── poppy → hosts/poppy/ + home/
home/ vs hosts/
| what | where | why |
|---|---|---|
| shell config | home/ |
same on all machines |
| terminal emulator | home/ |
gui apps belong here |
| system packages | hosts/<name>/ |
os-specific |
| networking | hosts/<name>/ |
per-host |
| hostname | hosts/<name>/ |
obviously |
adding things
new package for all hosts:
→ add to home/cli.nix in home.packages
new package for one host:
→ add to hosts/<name>/default.nix in environment.systemPackages
new alias for all hosts:
→ add to home/zsh.nix in programs.zsh.shellAliases
new alias for one host:
→ add to hosts/<name>/default.nix in home-manager.users.mikl.programs.zsh.shellAliases
host-specific imports
poppy imports home/kitty.nix because it has a screen. muscari doesn't.
# hosts/poppy/default.nix
home-manager.users.mikl = {
imports = [ ../../home/kitty.nix ];
programs.zsh.shellAliases = {
switch = "darwin-rebuild switch --flake .#poppy";
};
};