# Nix Configuration A comprehensive Nix configuration for managing multiple machines with a unified approach. This repository contains configurations for macOS (Darwin) and Linux systems, with shared home-manager configurations and custom packages. ## Overview This repository manages the following machines: - **meili** - macOS laptop (aarch64-darwin) - **modgud** - Linux server (x86_64-linux) Each machine has its own system configuration and home-manager setup, with shared modules and features. ## Project Structure ``` . ├── flake.nix # Main flake configuration ├── hosts/ # System-specific configurations │ ├── meili/ # macOS laptop configuration │ └── modgud/ # Linux server configuration ├── home/ # My home-manager configurations │ └── features/ # Shared home-manager features │ ├── cli/ # CLI tools (git, fish, tmux, etc.) │ ├── desktop/ # Desktop applications (aerospace, ghostty, etc.) │ └── nvim/ # Neovim configuration ├── modules/ # Shared NixOS/Darwin modules ├── packages/ # Custom packages ├── lib/ # Helper functions └── overlays/ # Nixpkgs overlays ``` ## Quick Start ### For macOS (meili) > Note: > There is a thing where the terminal emulator needs full disk access for homebrew and other things to work correctly, but I'm also using Ghostty installed via Homebrew. Therefor, after the `darwin-rebuild switch` a `brew bundle`. ```bash # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Add `darwin-rebuild` to shell nix shell github:lnl7/nix-darwin#darwin-rebuild # Apply system configuration sudo darwin-rebuild switch --flake .#meili # Install the brew packages brew bundle # Allow Full Disk Access to Ghossty # System Settings # -> Privacy & Security # -> Full Disk Access # -> Add Ghostty # Add kanata to Input Monitoring # System Settings # -> Privacy & Security # -> Input Monitoring # -> + /run/current-system/sw/bin/kanata # Apply system configuration one more time sudo darwin-rebuild switch --flake .#meili # Apply home-manager configuration nix run github:nix-community/home-manager -- switch --flake .#thomas@meili ``` ### For Linux (modgud) ```bash # Apply system configuration (if NixOS) nix run github:nix-community/nixos-anywhere -- --flake .#modgud root@modgud.t5.st # Apply home-manager configuration nix run github:nix-community/home-manager -- switch --flake .#thomas@modgud ``` ### For Asahi Fedora (fedora) ``` # Add trusted users echo "trusted-users = root @wheel @admin" | sudo tee -a /etc/nix/nix.custom.conf # Restart nix-daemon to apply changes sudo systemctl restart nix-daemon # Add ghostty sudo dnf copr enable pgdev/ghostty sudo dnf install ghostty ``` ## Features ### Shared CLI Tools - **Fish shell** - Interactive shell with completions - **Git** - Version control with custom configuration - **TMUX** - Terminal multiplexer with custom keybindings - **Starship** - Cross-shell prompt - **Bat** - Better cat with syntax highlighting - **SSH** - Secure shell configuration - **GnuPG** - Encryption and signing ### Desktop Features (macOS only) - **AeroSpace** - i3-style tiling window manager - **Ghostty** - Modern terminal emulator - **Zen Browser** - Privacy-focused browser - **Brave Browser** - Used for YouTube app window - **YubiKey** - Hardware security key support - **Fonts** - Custom font configuration ### Development Tools - **Neovim** - Text editor with LSP, treesitter, and telescope - **Custom packages** - Including photo-cli for photo management ## Custom Packages This repository includes several custom packages: - `photo-cli` - Photo management and organization tool - `tmux-select-pane-no-wrap` - TMUX pane selection without wrapping - `aerospace-tmux-focus` - Integration between AeroSpace and TMUX - `hello` - Example package ## Machine-Specific Configurations ### meili (macOS Laptop) - **System**: aarch64-darwin - **Features**: Full desktop environment with tiling window manager - **Location**: America/Los_Angeles timezone - **Services**: Remote login enabled ### modgud (Linux Server) - **System**: x86_64-linux - **Features**: Server-focused configuration with minimal desktop components - **Location**: Europe/Amsterdam timezone - **Services**: Reverse proxy, identity provider, P2P mesh network ## Development ### Adding a New Machine 1. Create a new directory in `hosts/` for your machine 2. Add system configuration to `flake.nix` 3. Create home-manager configuration in `home/` 4. Add any machine-specific modules as needed ### Adding New Features 1. Create feature modules in `home/features/` 2. Import them in the appropriate machine configurations 3. Update documentation as needed ## Notes - The configuration uses Nix flake inputs for reproducible builds - Home-manager configurations are shared between machines where appropriate - Custom packages are defined in the `packages/` directory - The `lib/` directory contains helper functions for creating configurations ## Photo Management Commands For photo organization, use the custom `photo-cli` package: ```bash # Copy photos with folder hierarchy preservation photo-cli copy \ --process-type SubFoldersPreserveFolderHierarchy \ --naming-style DateTimeWithSecondsAddress \ --number-style PaddingZeroCharacter \ --folder-append DayRange \ --folder-append-location Prefix \ --reverse-geocode OpenStreetMapFoundation \ --openstreetmap-properties country city town suburb \ --no-coordinate InSubFolder \ --no-taken-date InSubFolder \ --verify \ --output ~/Photos # Flatten all subfolders with address-based grouping photo-cli copy \ --process-type FlattenAllSubFolders \ --group-by AddressHierarchy \ --naming-style DayAddress \ --reverse-geocode OpenStreetMapFoundation \ --openstreetmap-properties country city town suburb \ --number-style OnlySequentialNumbers \ --no-taken-date AppendToEndOrderByFileName \ --no-coordinate InSubFolder \ --input ~/Backup \ --output ~/Photos \ --dry-run --verify ``` ## Roadmap - **Use flakes for local paths:** Convert local paths (e.g., `import ./lib`) to flake inputs. This improves reproducibility by explicitly declaring dependencies and makes it easier to manage different versions of local modules. - **Centralize library functions:** Make commonly used functions in the `lib` directory available as a module or overlay. This promotes code reuse and simplifies configuration. - **Add descriptions to outputs:** Add descriptions to the outputs of the flake. This makes it easier to understand the purpose of each output and improves the overall usability of the flake.