This repository contains Nix configurations for managing both personal workstations and homelab infrastructure. It serves as the single source of truth for all system configurations, ensuring consistency, reproducibility, and maintainability across all environments.
- macOS Workstations: Managed via nix-darwin
mac-studiomacbook-prolaisas-mac-mini
- Linux Workstations:
fredpc(x86_64-linux with GUI, NVIDIA CUDA support)macbookx86(x86_64-linux on Apple T2 hardware)nixosaarch64vm(aarch64-linux)
- Build Machines:
fredpc: Builds x86_64-linux configurationsnixosaarch64vm: Builds aarch64-linux configurationsarm64builder: Dedicated aarch64-linux build server
- Infrastructure Services (Managed via Colmena):
dns1,dns2: DNS serversgitea: Git repository hostinggitea-runner-1,gitea-runner-2,gitea-runner-3: CI/CD runnersuptime-kuma: Uptime monitoringprometheus: Metrics collectiongrafana: Metrics visualizationsonarqube: Code quality analysislarussa: Media server (Jellyfin, Radarr, Sonarr)jellyseerr: Media request managementprowlarr: Indexer managementn8n: Workflow automationexternal-metrics: External metrics collectionglance: Dashboard applicationminio: Object storage
The infrastructure uses multiple VLANs for security and organization:
- Administration (VLAN 1): Server management and monitoring
- Services (VLAN 50): Public-facing services and applications
- IoT (VLAN 40): Internet of Things devices (isolated)
- Workstations (VLAN 30): User devices and workstations
- Uptime Monitoring: Uptime Kuma tracks service availability and SSL certificates
- Metrics: Prometheus collects system and application metrics
- Alerting: Configured for both critical and warning-level notifications
- Nix installed on your system
- SSH Key (
id_ed25519) in your~/.sshdirectory - Homebrew installed for package management
- Git for version control
Note: The
id_ed25519key is used for personal secrets and must be properly secured with 600 permissions.
This repository uses devenv to provide a consistent development environment. The devenv.nix file contains all the libraries and helper scripts needed for processing this repository.
- Development Tools: Includes tools like
colmena,just,alejandra,statix, and other utilities - Helper Scripts: Automated scripts for updating NPM packages, container digests, fetcher repos, and more
- Consistent Environment: Ensures all contributors have the same tooling and dependencies
To enter the development environment:
cd ~/nix
devenv shellThis will load all the tools and environment variables defined in devenv.nix. Once inside the environment, you can use the helper scripts and tools without additional installation.
If you have direnv installed and configured, the development environment will be automatically activated when you enter the repository directory.
This project uses just for task automation. Here are the available targets:
switch- Switches the system to the current configurationbuild- Builds the system in its current formupdate-all- Updates everything (runs update, update-npm-packages, update-repos, update-container-digests, and update-secrets)update- Updates input definitions from remote resourcesupdate-npm-packages- Updates NPM packagesupdate-repos- Pulls the latest hashes and shas from the repos inapps/fetcher/repos.tomlupdate-container-digests- Updates the SHA digests of container imagesupdate-secrets- Updates the secrets flakeformat- Format all .nix files with alejandralint- Linting for the project with statixcolmena HOST- Runs colmena remote switch on the specified hostcolmena-dns- Runs colmena apply on dns1 and dns2 hosts
This project uses Podman for container runtime with the following practices:
- Image Management:
- Images are pinned to specific digests for reproducibility
- The
container-digesttool generates Nix files with SHA256 hashes - Container updates are explicit and intentional
-
Install Nix (if not already installed):
sh <(curl -L https://nixos.org/nix/install) -
Install Homebrew (required):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" -
Clone this repository:
git clone https://github.com/fred-drake/nix ~/nix cd ~/nix
-
Build the flake for your system. This will take a while the first time.
- Macbook Pro:
nix --extra-experimental-features "nix-command flakes" build .#darwinConfigurations.macbook-pro.system - Mac Studio:
nix --extra-experimental-features "nix-command flakes" build .#darwinConfigurations.mac-studio.system - My better half's Mac Mini:
nix --extra-experimental-features "nix-command flakes" build .#darwinConfigurations.laisas-mac-mini.system - Linux PC:
nix --extra-experimental-features "nix-command flakes" build .#nixosConfigurations.fredpc.system
- Macbook Pro:
- Used for personal secrets and configurations
- Applies to both workstations and servers
- Manages user-specific settings and access tokens
- Dedicated to server infrastructure
- Manages service credentials and system configurations
- Separate from personal keys for better security
- Modular Design: Configurations are broken into reusable modules
- DRY Principle: Common patterns are extracted into functions
- Naming: Descriptive and consistent naming conventions are used throughout
- Package References: Use
outPathfor symlinks to package locations - VS Code Extensions: Managed through Home Manager configuration
- Remote Deployment: Colmena is used for managing remote server configurations
For assistance with Nix configurations:
- Use
nixosMCP server for NixOS-specific functionality - Use
context7MCP server for general Nix syntax assistance
- Run the initial switch into the flake. This will take a long while the first time:
./result/sw/bin/darwin-rebuild switch --flake ~/nix - Reboot the machine to ensure all Mac settings were applied.
- Run the initial switch into the flake:
sudo nixos-rebuild switch --flake ~/nix - Reboot if needed for hardware changes.
- Allow Apple Watch to be unlock the computer or sudo:
Settings -> Touch ID & Password -> Use Apple Watch to unlock applications and your Mac - Open Raycast and import configuration from iCloud Drive
- Disable spotlight search:
Settings -> Keyboard shortcuts -> Disable Spotlight Search. Raycast will now be the default search tool when hitting Cmd+Space.