# SaugOS

A dev-focused NixOS configuration for older laptops, distilled from [ZaneyOS](https://gitlab.com/Zaney/zaneyos). Uses the **Niri** scrolling tiling Wayland compositor with Catppuccin Mocha theming, Waybar, and a curated set of development tools.

## What's Included

- **Niri** window manager with full keybindings, window rules, and waybar integration
- **Neovim** (via nvf) with LSP, Treesitter, Telescope — full IDE setup
- **VS Code**, **Ghostty**, **Kitty**, **Tmux**
- **Zsh** with Powerlevel10k, Oh-My-Zsh, syntax highlighting
- **Yazi** file manager, **lazygit**, **bat**, **eza**, **fzf**, **zoxide**
- **Stylix** system-wide theming (Catppuccin Mocha, JetBrains Mono)
- **TLP** + **thermald** for laptop power management
- **Docker** for containerized development
- **Rofi** launcher, **swaync** notifications, **wlogout**is

## Requirements

- A NixOS installation (25.11+) with flakes enabled
- x86_64 system with Intel or AMD integrated graphics (or a VM)

## Installation

### 1. Clone into position

```bash
cd ~   
cd SaugOS
```

### 2. Configure your host

Copy the default host template for your machine:

```bash
cp -r hosts/default hosts/<your-hostname>
```

Edit `hosts/<your-hostname>/variables.nix` to set your preferences:

- `gitUsername` / `gitEmail` — your identity
- `terminal` — default terminal (`ghostty`, `kitty`, `alacritty`, `wezterm`)
- `browser` — default browser
- `keyboardLayout` — keyboard layout (`us`, `de`, etc.)
- `clock24h` — 24-hour clock format
- `stylixImage` — wallpaper/theme source image
- Toggle `tmuxEnable`, `vscodeEnable`, `ghosttyEnable`, etc.

### 3. Generate hardware config

```bash
sudo nixos-generate-config --show-hardware-config > hosts/<your-hostname>/hardware.nix
```

### 4. Update flake.nix

Edit `flake.nix` and set the `host` and `profile` variables:

```nix
host = "<your-hostname>";
profile = "intel";  # or "amd" or "vm"
```

### 5. Build and switch

```bash
# Stage files so the flake can see them
git add -A

# Build the system
sudo nixos-rebuild switch --flake .#<profile>
```

Where `<profile>` is `intel`, `amd`, or `vm`.

### After first boot

The included CLI tool `saugcli` handles ongoing management:

```bash
saugcli rebuild          # Rebuild and switch
saugcli rebuild-boot     # Rebuild for next boot
saugcli update           # Update flake inputs + rebuild
saugcli cleanup          # Remove old generations
saugcli diag             # Generate hardware report
saugcli trim             # SSD TRIM
saugcli update-host      # Auto-detect and set host/profile in flake.nix
saugcli add-host <name>  # Add a new host from the default template
```

Options for `rebuild`/`update`:
- `--dry` / `-n` — preview without applying
- `--ask` / `-a` — confirmation prompts
- `--cores N` — limit CPU cores (useful on low-resource machines)
- `--verbose` / `-v` — detailed output

## Profiles

| Profile | GPU | Use Case |
|---------|-----|----------|
| `intel` | Intel integrated | Most older laptops |
| `amd`   | AMD integrated   | AMD-based laptops  |
| `vm`    | VirtIO/VMware    | Virtual machines   |

## Key Files

| File | Purpose |
|------|---------|
| `flake.nix` | Inputs, outputs, host/profile selection |
| `hosts/<host>/variables.nix` | Per-machine settings (control panel) |
| `hosts/<host>/hardware.nix` | Hardware scan output |
| `hosts/<host>/host-packages.nix` | Machine-specific packages |
| `modules/core/packages.nix` | System-wide packages |
| `modules/home/niri/binds.nix` | Keybindings |
| `modules/home/scripts/saugcli.nix` | CLI management tool |

## Default Keybindings (Niri)

| Key | Action |
|-----|--------|
| `Super + Return` | Open terminal |
| `Super + D` | Rofi app launcher |
| `Super + Q` | Close window |
| `Super + 1-9` | Switch workspace |
| `Super + Shift + 1-9` | Move window to workspace |
| `Super + H/J/K/L` | Focus left/down/up/right |
| `Super + Shift + H/L` | Move column left/right |
| `Super + F` | Maximize column |
| `Super + Shift + F` | Fullscreen |
| `Super + Print` | Screenshot (region) |
