Files
nixos-config/docs/adding-software.md
kiskaadee 7f69390afd refactor(python): isolate language tooling to devshells and remove obsolete aliases
- Remove pyright, ruff, and mypy from global home.packages in home/dev.nix
- Keep uv globally as the universal runner and environment bootstrapper
- Remove obsolete p5 and p5w aliases from home/shell.nix
- Expose devShells.${system}.default in flake.nix with repository linters
- Update adding-software.md and neovim.md to reflect devshell resolution
2026-10-18 23:13:38 -05:00

99 lines
3.3 KiB
Markdown

# 📦 Adding Software: Placement & Packaging Guide
This guide defines the architectural decision tree for introducing new software, packages, or services into the workstation configuration.
---
## 1. Package Placement Decision Tree
When adding a tool or application, follow this priority hierarchy:
```text
Is it a kernel module, hardware driver, or root systemd daemon?
├── YES ──> system/core.nix or system/hardware.nix
└── NO
│
Is it a GUI application or desktop utility?
├── YES ──> home/desktop.nix
└── NO
│
Is it a compiler, LSP, language runtime, or dev tool?
├── YES ──> home/dev.nix
└── NO ──> home/shell.nix (CLI tools, shell integration)
```
---
## 2. Directory Placement Reference
| File | Scope | Examples |
| :--- | :--- | :--- |
| **`system/core.nix`** | Root OS fundamentals | Kernel params, OpenSSH daemon, locale, user definitions, Nix-LD |
| **`system/hardware.nix`** | Hardware daemons & root services | PipeWire, Docker, Bluetooth (`bluez`), Power management (`tlp`), CUPS printing |
| **`system/desktop.nix`** | Display server & greeter | Niri compositor enablement, DMS greeter, greetd, system typography/fonts |
| **`home/desktop.nix`** | User graphical applications | Zen Browser, Zed, Obsidian, LibreOffice, GIMP, MPV, grim/slurp, DankSearch |
| **`home/dev.nix`** | Toolchains & development | Rust, uv, Node, Go, language servers (nil, rust-analyzer), Antigravity, sops/age CLI |
| **`home/shell.nix`** | Interactive shell & CLI tools | Bash, Tmux, Git, Starship, Delta, Fastfetch, ripgrep, fzf, bat, jq, eza |
---
## 3. Package Syntax Styles: When to Use What
### Pattern A: Simple Package List (`home.packages`)
Use when the tool requires no specialized shell wrappers or generated dotfiles:
```nix
# Example in home/desktop.nix or home/shell.nix
home.packages = with pkgs; [
ripgrep
htop
jq
];
```
### Pattern B: Home Manager Program Module (`programs.<name>`)
Use when Home Manager provides an upstream module that configures shell completions, systemd user services, or dotfiles:
```nix
# Example in home/shell.nix
programs.tmux = {
enable = true;
shortcut = "a";
terminal = "tmux-256color";
};
```
*Advantage*: Modules handle initialization scripts, environment variables, and shell aliases automatically.
### Pattern C: Custom Compiled Scripts (`pkgs.writeScriptBin`)
Use when distributing a bespoke script or python tool into the user's `$PATH`:
```nix
# Example in home/desktop.nix
let
recordScript = pkgs.writeScriptBin "record" (builtins.readFile ./scripts/record.sh);
in
{
home.packages = [ recordScript ];
}
```
---
## 4. Handling Unfree Software
Unfree packages are permitted globally in `system/core.nix` and `home/default.nix`:
```nix
nixpkgs.config.allowUnfree = true;
```
You do not need to configure per-package unfree predicate overrides unless isolating builds.
---
## 5. What NOT to Add to this Repository
1. **Homelab Server Daemons**: Production services (Traefik, DDNS monitors, public web services, databases) belong exclusively in the [`Core`](file:///home/kiskaadee/Projects/active/homelab/Core) repository.
2. **Ephemeral Project Dependencies**: Rather than polluting `home/dev.nix` with temporary project dependencies, create a dedicated `flake.nix` or `shell.nix` in that project's directory and use `direnv`.