Skip to content

delafthi/dotfiles

Repository files navigation

delafthi's dotfiles

Personal configuration files for managing Linux and macOS (Darwin) environments using Nix and home-manager.

Installation

Prerequisites

  • Nix with flakes enabled (installation guide)
  • age key for secrets management (optional, required for sops-encrypted secrets)

Quick Start

  1. Clone the repository
git clone https://github.com/delafthi/dotfiles.git
cd dotfiles
  1. Apply the configuration

The system auto-detects your platform and hostname:

nix run .#apply

Or use the rebuild commands directly:

# macOS
sudo darwin-rebuild switch --flake .#$(hostname)

# NixOS
sudo nixos-rebuild switch --flake .#$(hostname)
  1. Log out and back in to apply all settings

Adding a New Host

  1. Create a new directory under hosts/darwin/ or hosts/nixos/
  2. Add configuration.nix and home.nix files
  3. Reference the new host in flake.nix
  4. Update the hostname and SSH keys in the flake configuration

Development

Available Commands

# Apply configuration (auto-detects platform)
nix run .#apply

# Apply configuration for a specific host
nix run .#apply -- my-machine

# Format all files
nix fmt

# Check flake validity and run linters
nix flake check

# Update flake dependencies
nix flake update

Development Shell

The repository includes direnv integration for automatic shell activation. With direnv and nix-direnv installed, the development shell loads automatically when entering the directory.

Manual activation:

nix develop

This provides age, age-plugin-yubikey, nixd (Nix language server), and sops automatically.

Automatic activation with direnv:

  1. Install direnv and nix-direnv (included in this configuration)
  2. Run direnv allow in the repository root
  3. The development shell will activate automatically when you cd into the directory

Secrets Management

Secrets are managed using sops-nix with age encryption.

Setup

  1. Generate or import your age key:
# Generate a new age key
age-keygen -o ~/.config/sops/age/keys.txt

# Or use age-plugin-yubikey
age-plugin-yubikey --generate
  1. Update .sops.yaml with your age key

  2. Create or edit secrets:

sops secrets.yaml

Structure

  • .sops.yaml - SOPS configuration with age keys
  • secrets.yaml - Encrypted secrets file
  • Secrets are referenced in Nix configurations using config.sops.secrets.*

License

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

About

My dotfiles managed with Nix

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •