Skip to content

fredrikaverpil/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

dotfiles 🍩

screenshot

Personal dotfiles using Nix for reproducible system/package management and GNU Stow for dotfile symlinking.

Quick start

Initial installation

[!IMPORTANT]

Make sure your terminal has full disk access on macOS before installing.

# Clone repo
git clone https://github.com/fredrikaverpil/dotfiles.git ~/.dotfiles
cd ~/.dotfiles

# Install Nix (Determinate Systems installer - enables flakes by default, better uninstall,
# survives macOS updates, consistent installation across Linux/macOS)
# Choose "Determinate Nix" when prompted (performance optimized, better error messages)
# Learn more: https://determinate.systems/nix
# IMPORTANT: choose "no" during install, so to install upstream Nix.
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

# Set hostname to match a configuration in nix/hosts/
# macOS: sudo scutil --set HostName <hostname>
# Linux: sudo hostnamectl set-hostname <hostname>

# Apply configuration
# Linux (NixOS):
sudo nixos-rebuild switch --flake ~/.dotfiles#$(hostname)

# macOS (first time only):
sudo nix --extra-experimental-features "nix-command flakes" run nix-darwin -- switch --flake ~/.dotfiles#$(hostname)

# After first-time setup, use the rebuild script:
./rebuild.sh
# Rebuild system + packages + dotfiles
./rebuild.sh

# Update flake inputs (nixpkgs, home-manager, etc.) then rebuild + dotfiles
./rebuild.sh --update

# Dotfiles only (no Nix rebuild)
./rebuild.sh --stow
Troubleshooting

Update stable vs unstable

# Update all unstable/Darwin-related inputs (dev machines)
nix flake lock \
  --update-input nixpkgs-unstable \
  --update-input home-manager-unstable \
  --update-input nix-darwin \
  --update-input dotfiles

# Update all stable/Linux-related inputs (prod servers)
nix flake lock \
  --update-input nixpkgs \
  --update-input home-manager \
  --update-input nixos-raspberrypi \
  --update-input disko \
  --update-input dotfiles

macOS permissions

If you get errors about com.apple.universalaccess or system settings during nix-darwin activation:

  1. Grant Full Disk Access to your terminal:
    • Open System Settings > Privacy & Security > Full Disk Access
    • Click + and add your terminal app (e.g., /Applications/Utilities/Terminal.app)
    • Enable the checkbox for your terminal

SSL certificate issues (when choosing upstream Nix)

If you get SSL certificate errors after switching from Determinate to upstream Nix:

# Fix broken certificate symlink
sudo rm /etc/ssl/certs/ca-certificates.crt
sudo ln -s /etc/ssl/cert.pem /etc/ssl/certs/ca-certificates.crt

# Clean up leftover Determinate configuration
sudo cp /etc/nix/nix.conf /etc/nix/nix.conf.backup
sudo tee /etc/nix/nix.conf << 'EOF'
extra-experimental-features = nix-command flakes
max-jobs = auto
ssl-cert-file = /etc/ssl/cert.pem
EOF

General troubleshooting

# Check configuration
nix flake check ~/.dotfiles

# Verbose rebuild
sudo nixos-rebuild switch --flake ~/.dotfiles --show-trace  # Linux
darwin-rebuild switch --flake ~/.dotfiles --show-trace      # macOS

# Clean cache
nix-collect-garbage -d

# Rollback
sudo nixos-rebuild --rollback  # Linux
darwin-rebuild --rollback      # macOS

Nix management responsibilities

Repo structure
β”œβ”€β”€ nix/                             # Nix configurations
β”‚   β”œβ”€β”€ hosts/                       # Host-specific configurations
β”‚   β”‚   └── $host/                   # Individual host directory
β”‚   β”‚       β”œβ”€β”€ configuration.nix    # System settings
β”‚   β”‚       β”œβ”€β”€ hardware.nix         # Hardware config (optional, for NixOS)
β”‚   β”‚       └── users/
β”‚   β”‚           └── $username.nix    # User config
β”‚   β”œβ”€β”€ lib/                         # Helper functions
β”‚   β”‚   β”œβ”€β”€ default.nix              # Library entry point
β”‚   β”‚   β”œβ”€β”€ systems.nix              # System configuration helpers
β”‚   β”‚   └── users.nix                # User configuration helpers
β”‚   └── shared/                      # Shared configurations
β”‚       β”œβ”€β”€ home/
β”‚       β”‚   β”œβ”€β”€ common.nix           # Cross-platform user packages
β”‚       β”‚   β”œβ”€β”€ darwin.nix           # macOS user config
β”‚       β”‚   └── linux.nix            # Linux user config
β”‚       β”œβ”€β”€ overlays/
β”‚       β”‚   β”œβ”€β”€ default.nix          # Overlay entry point
β”‚       β”‚   └── neovim.nix           # Neovim overlay
β”‚       └── system/
β”‚           β”œβ”€β”€ common.nix           # Cross-platform system packages
β”‚           β”œβ”€β”€ darwin.nix           # macOS system config + Homebrew
β”‚           └── linux.nix            # Linux system config
β”œβ”€β”€ nvim-fredrik/                    # Neovim configuration
β”œβ”€β”€ shell/                           # Shell configuration
β”‚   β”œβ”€β”€ bin/                         # Custom shell scripts
β”‚   β”œβ”€β”€ aliases.sh                   # Shell aliases
β”‚   β”œβ”€β”€ exports.sh                   # Environment variables
β”‚   └── sourcing.sh                  # Shell sourcing logic
β”œβ”€β”€ stow/                            # GNU Stow dotfiles
β”œβ”€β”€ extras/                          # One-off platform-specific extras and legacy configs
β”œβ”€β”€ flake.nix                        # Nix flake configuration
└── rebuild.sh                       # Main rebuild script

Components

Component Tool Scope Configuration Location
User dotfiles GNU Stow Per-user stow/
User packages home-manager Per-user nix/shared/home/
User preferences home-manager Per-user nix/shared/home/ + host-specific
Host configuration nix-darwin/NixOS System-wide nix/hosts/*/configuration.nix
System packages nix-darwin/NixOS System-wide nix/shared/system/
System settings nix-darwin/NixOS System-wide nix/shared/system/
Homebrew packages nix-darwin System-wide nix/shared/system/darwin.nix
Package overlays Nix System-wide nix/shared/overlays/

Packages

Package Type macOS System macOS User Linux System Linux User
CLI tools Nix Nix Nix Nix
GUI apps Homebrew Homebrew Nix Nix
Mac App Store apps Homebrew Homebrew - -
Fonts Nix Nix Nix Nix

Package sources

The intent here is to follow "unstable" sources on development machines, but remain "stable" on e.g. production servers.

Component macOS Source Linux Source Rationale
nixpkgs nixpkgs-unstable nixpkgs (25.05) macOS: latest, Linux: stable
home-manager home-manager-unstable release-25.05 macOS: latest, Linux: stable
nix-darwin master (uses unstable) - Always latest features

Registry shortcuts:

# Stable packages
nix shell n#neovim

# Unstable packages
nix shell u#nodejs_22

Dotfiles

Dotfiles are managed with GNU Stow, not Nix:

  • Edit files in stow/ directory
  • Changes are immediately active (no rebuild needed)
  • Nix runs stow commands during home-manager activation
# Manual stow (if needed)
cd ~/.dotfiles/stow
stow --target="$HOME" --restow shared "$(uname -s)"

Other READMEs and references

Host-specific documentation

Non-Nix legacy docs

Neovim ⌨️

Git πŸ™

Project config/tooling 🧒

Fonts πŸ’―

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks