Skip to content

keanuk/nix-config

Repository files navigation

🏠 Keanu's Nix Configuration

Personal NixOS and nix-darwin configuration files using Nix flakes. This repository contains configurations for multiple devices across different architectures and use cases.

πŸ–₯️ Devices Overview

NixOS Systems (Linux)

Device Description Architecture Role Notes
beehive Beelink SER9 Pro x86_64 Home Server Media server with Jellyfin, Plex, *arr stack
earth Intel NUC 10 i7 x86_64 Mini PC Compact desktop
hyperion HP EliteBook 845 G8 x86_64 Laptop Desktop with Pantheon DE
miranda HP EliteBook 1030 G2 x86_64 Laptop Portable workstation
phoebe ThinkPad P14s AMD Gen 5 x86_64 Laptop Development machine
tethys Zotac ZBox x86_64 Mini PC Compact desktop
titan CyberPowerPC x86_64 Desktop High-performance workstation

macOS Systems (Darwin)

Device Description Architecture Role Notes
salacia Mac Mini 2024 aarch64 Desktop Apple Silicon workstation
vesta MacBook Pro 2020 x86_64 Laptop Intel-based portable
charon MacBook Air 2018 x86_64 Laptop Lightweight portable

Windows Systems (WSL)

Device Description Architecture Role Notes
mars ThinkPad X13s Gen 1 aarch64 Desktop Portable workstation with cellular

πŸ› οΈ Key Tools & Utilities

Development

  • Git - Version control with custom configuration
  • Neovim/Nixvim - Modern Vim-based editor with Nix configuration
  • Helix - Post-modern text editor
  • GitHub CLI (gh) - GitHub integration
  • Just - Command runner for project automation

Shell & Terminal

  • Fish - Friendly interactive shell
  • Atuin - Magical shell history
  • Starship - Cross-shell prompt
  • Fzf - Fuzzy finder
  • Direnv - Environment variable management
  • Eza - Modern ls replacement
  • Bat - Cat with syntax highlighting
  • Ripgrep - Fast text search
  • Bottom - System resource monitor

System Management

  • Home Manager - Declarative user environment management
  • Nix Helper (nh) - Simplified Nix commands
  • SOPS - Secrets management
  • Disko - Declarative disk partitioning
  • Lanzaboote - Secure Boot for NixOS

Media & Entertainment

  • Jellyfin - Media server (earth)
  • Plex - Media server (earth)
  • Sonarr/Radarr/Lidarr - Media automation (earth)
  • Prowlarr - Indexer management (earth)

πŸš€ Getting Started

Prerequisites

  1. Nix with flakes enabled:

    # On NixOS, enable in configuration.nix:
    nix.settings.experimental-features = [ "nix-command" "flakes" ];
    
    # On other systems, add to ~/.config/nix/nix.conf:
    experimental-features = nix-command flakes
  2. Required tools:

    nix profile install nixpkgs#git nixpkgs#just nixpkgs#nh

Initial Setup

  1. Clone the repository:

    git clone https://github.com/keanu/nix-config ~/.config/nix-config
    cd ~/.config/nix-config
  2. Set up SOPS encryption (for secrets):

    # Generate age key from SSH key:
    ssh-to-age -private-key -i ~/.ssh/id_ed25519 > ~/.config/sops/age/keys.txt
    
    # Or generate new age key:
    age-keygen -o ~/.config/sops/age/keys.txt
    
    # Get public key for adding to .sops.yaml:
    age-keygen -y ~/.config/sops/age/keys.txt

Building & Switching

The configuration uses Just for convenient command execution:

# List all available commands
just

# Build and switch both OS and Home Manager
just switch

# Build and switch only Home Manager
just home

# Build and switch only OS configuration
just host

# Update flake inputs
just update

# Clean up old generations
just gc

Manual Commands

If you prefer manual commands:

# NixOS system
sudo nixos-rebuild switch --flake .#hostname

# nix-darwin
darwin-rebuild switch --flake .#hostname

# Home Manager
home-manager switch --flake .#username@hostname

πŸ“ Repository Structure

.
β”œβ”€β”€ flake.nix                 # Main flake configuration
β”œβ”€β”€ flake.lock               # Locked dependency versions
β”œβ”€β”€ justfile                 # Task runner commands
β”‚
β”œβ”€β”€ nixos/                   # NixOS configurations
β”‚   β”œβ”€β”€ _mixins/            # Reusable NixOS configuration modules
β”‚   β”‚   β”œβ”€β”€ base/           # Base system configs (boot, impermanence, laptop, server, etc.)
β”‚   β”‚   β”œβ”€β”€ desktop/        # Desktop environments (COSMIC, GNOME, Hyprland, Pantheon, Plasma)
β”‚   β”‚   β”œβ”€β”€ programs/       # System programs (nh, Steam, Evolution)
β”‚   β”‚   β”œβ”€β”€ services/       # System services (Jellyfin, Plex, *arr, Tailscale, etc.)
β”‚   β”‚   β”œβ”€β”€ user/           # User account configurations
β”‚   β”‚   └── virtualization/ # Virtualization configs
β”‚   β”œβ”€β”€ beehive/            # Beelink SER9 Pro
β”‚   β”œβ”€β”€ earth/              # Intel NUC server
β”‚   β”œβ”€β”€ hyperion/           # HP EliteBook 845 G8
β”‚   β”œβ”€β”€ miranda/            # HP EliteBook 1030 G2
β”‚   β”œβ”€β”€ phoebe/             # ThinkPad P14s AMD Gen 5
β”‚   β”œβ”€β”€ tethys/             # Zotac ZBox
β”‚   β”œβ”€β”€ titan/              # CyberPowerPC desktop
β”‚   └── mars/               # ThinkPad X13s Gen 1 (WSL)
β”‚
β”œβ”€β”€ darwin/                  # macOS (nix-darwin) configurations
β”‚   β”œβ”€β”€ _mixins/            # Reusable Darwin configuration modules
β”‚   β”‚   β”œβ”€β”€ base/           # Base macOS configs
β”‚   β”‚   β”œβ”€β”€ desktop/        # Desktop-related macOS configs
β”‚   β”‚   β”œβ”€β”€ services/       # macOS services
β”‚   β”‚   └── user/           # User account configurations
β”‚   β”œβ”€β”€ salacia/            # Mac Mini 2024
β”‚   β”œβ”€β”€ vesta/              # MacBook Pro 2020
β”‚   └── charon/             # MacBook Air 2018
β”‚
β”œβ”€β”€ home/                    # Home Manager configurations
β”‚   β”œβ”€β”€ _mixins/            # Reusable Home Manager modules
β”‚   β”‚   β”œβ”€β”€ base/           # Base home configs (default, impermanence, server, wsl)
β”‚   β”‚   β”œβ”€β”€ darwin/         # Darwin-specific home configs
β”‚   β”‚   β”œβ”€β”€ desktop/        # Desktop apps (Firefox, VSCode, GNOME, Kitty, Thunderbird, Zed, etc.)
β”‚   β”‚   β”œβ”€β”€ dev/            # Language toolchains (C, Rust, Python, Go, Nix, Java, etc.)
β”‚   β”‚   └── shell/          # Shell tools (Fish, Starship, Atuin, Git, Neovim, Helix, etc.)
β”‚   └── [hostname]/         # Per-host user configurations (e.g., hyperion/keanu.nix)
β”‚
β”œβ”€β”€ modules/                 # Custom NixOS and Home Manager modules
β”‚   β”œβ”€β”€ nixos/              # NixOS modules
β”‚   └── home-manager/       # Home Manager modules
β”œβ”€β”€ overlays/               # Package overlays
β”œβ”€β”€ pkgs/                   # Custom packages
└── secrets/                # Encrypted secrets (SOPS)

The _mixins Pattern

This configuration uses a _mixins pattern for modular, composable system configuration. Instead of a monolithic common/ directory, configurations are organized into small, focused modules that can be mixed and matched per host.

How it works:

  1. Mixins are organized by category - Each _mixins/ directory contains subdirectories grouping related functionality (e.g., base/, desktop/, services/)

  2. Host configurations import only what they need - Each host's default.nix imports specific mixins:

    # Example: nixos/hyperion/default.nix
    imports = [
      ../_mixins/base/default.nix
      ../_mixins/base/laptop.nix
      ../_mixins/desktop/pantheon/default.nix
      ../_mixins/services/tailscale/default.nix
    ];
    
  3. Fine-grained composition - Mix and match exactly the features needed:

    • A laptop gets base/laptop.nix, a server gets base/server.nix
    • Desktop systems import specific DE mixins (GNOME, Pantheon, Hyprland, etc.)
    • Media servers import only the services they need (Jellyfin, Plex, Sonarr, etc.)
  4. Consistent across platforms - The same pattern is used for:

    • NixOS (nixos/_mixins/) - System-level configuration
    • Darwin (darwin/_mixins/) - macOS system configuration
    • Home Manager (home/_mixins/) - User-level configuration

Benefits:

  • Clarity - Easy to see exactly what features a host uses
  • Reusability - Mixins are shared across hosts without duplication
  • Flexibility - Add or remove features by changing imports
  • Discoverability - Browse _mixins/ to see available options

πŸ”§ Configuration Details

Styling

  • Catppuccin theme across applications
  • Stylix for system-wide theming
  • Consistent fonts: Inter, JetBrains Mono, Nerd Fonts

Security

  • SOPS-nix for secrets management
  • Lanzaboote for Secure Boot on supported systems
  • Age encryption for sensitive data

Storage

  • Btrfs with snapshots on supported systems
  • Disko for declarative disk management
  • Impermanence for ephemeral root filesystem

πŸ”„ Maintenance

Updating

# Update all flake inputs
just update

# Update specific input
nix flake update nixpkgs

# Check for available updates
nix flake show --allow-import-from-derivation

Cleanup

# Remove old generations (keep 5 most recent)
just gc

# Manual cleanup
nix-collect-garbage -d
sudo nix-collect-garbage -d  # On NixOS

Debugging

# Check configuration syntax
nix flake check

# Build without switching
just build-host  # or just build-home

# View build logs
nix log /nix/store/...

πŸ“š Key Features

  • Multi-architecture support (x86_64, aarch64)
  • Cross-platform (NixOS, macOS)
  • Declarative secrets management with SOPS
  • Automated media server setup (earth)
  • Consistent development environment across all machines
  • Secure Boot support where applicable
  • Ephemeral root filesystem with impermanence
  • Custom overlays and packages

🀝 Contributing

This is a personal configuration, but feel free to:

  • Use parts of this configuration for your own setup
  • Report issues or suggest improvements
  • Submit PRs for general improvements

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

About

Personal configuration files for NixOS & Darwin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •