Nix flake for system configurations, dotfiles, and home server infrastructure
|
|
vor 5 Monaten | |
|---|---|---|
| home | vor 5 Monaten | |
| hosts | vor 6 Monaten | |
| lib | vor 9 Monaten | |
| modules | vor 6 Monaten | |
| overlays | vor 7 Monaten | |
| packages | vor 8 Monaten | |
| templates | vor 10 Monaten | |
| .editorconfig | vor 1 Jahr | |
| .envrc | vor 9 Monaten | |
| .gitignore | vor 6 Monaten | |
| LICENSE | vor 1 Jahr | |
| README.md | vor 10 Monaten | |
| flake.lock | vor 6 Monaten | |
| flake.nix | vor 6 Monaten | |
| shell.nix | vor 9 Monaten |
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.
This repository manages the following machines:
Each machine has its own system configuration and home-manager setup, with shared modules and features.
.
├── 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
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 switchabrew bundle.
# 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
# Apply system configuration (if NixOS)
nix run github:nix-community/nixos-anywhere -- --flake .#modgud [email protected]
# Apply home-manager configuration
nix run github:nix-community/home-manager -- switch --flake .#thomas@modgud
# 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
This repository includes several custom packages:
photo-cli - Photo management and organization tooltmux-select-pane-no-wrap - TMUX pane selection without wrappingaerospace-tmux-focus - Integration between AeroSpace and TMUXhello - Example packagehosts/ for your machineflake.nixhome/home/features/packages/ directorylib/ directory contains helper functions for creating configurationsFor photo organization, use the custom photo-cli package:
# 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
import ./lib) to flake inputs. This improves reproducibility by explicitly declaring dependencies and makes it easier to manage different versions of local modules.lib directory available as a module or overlay. This promotes code reuse and simplifies configuration.