Skip to content

richban/system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

755 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nix System Config & Dotfiles

Terminal Screenshot

This repository manages system configurations for macOS (via nix-darwin) and Linux (via standalone home-manager). All configurations are defined as a Nix flake.

🧠 Philosophy

  • nix-darwin and home-manager configurations are decoupled β€” both can be used independently.
  • home-manager is embedded as a module inside nix-darwin for macOS (via common.nix), but runs as a fully standalone tool on Linux.
  • sysdo β€” a Python CLI in bin/do.py β€” is the single entry point for all system management operations. It auto-detects the platform (Darwin / NixOS / Linux home-manager) so most commands work without extra flags.

πŸ–₯️ Configured Hosts

Flake attribute Platform Username Hostname Notes
melchior@aarch64-darwin macOS (Apple Silicon) melchior mac-mini nix-darwin + home-manager
richban@x86_64-linux Linux x86_64 richban SKB58713 standalone home-manager; flake at ~/.config/system

βš™οΈ Prerequisites β€” Install Nix

Run the Determinate Systems installer on any machine before anything else:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

πŸš€ Bootstrapping

macOS (nix-darwin)

Clone the repo and run the bootstrap command. sysdo bootstrap handles disk setup (/etc/synthetic.conf, /run symlink), builds the Darwin system closure, and activates it.

git clone https://github.com/richban/system ~/.nixpkgs
cd ~/.nixpkgs

# Bootstrap β€” auto-detects Darwin, defaults to melchior@aarch64-darwin
nix run .#sysdo bootstrap

# Or specify the host explicitly
nix run .#sysdo bootstrap melchior@aarch64-darwin

Linux (standalone home-manager)

The flake repo must be cloned to ~/.config/system on the Linux machine (this is required for the live nvim config symlink and shell functions to resolve correctly).

git clone https://github.com/richban/system ~/.config/system
cd ~/.config/system

# Bootstrap β€” installs home-manager and activates the profile in one step
nix run .#sysdo bootstrap richban@x86_64-linux

# Alternatively, drive home-manager directly (if sysdo is not yet available)
nix run --experimental-features "nix-command flakes" \
    github:nix-community/home-manager -- switch \
    --flake ~/.config/system#richban@x86_64-linux \
    -b backup

πŸ› οΈ sysdo Commands

sysdo is available in two ways:

  • Inside the dev shell: just sysdo <command>
  • From anywhere: nix run .#sysdo <command>
  • Without a local clone: nix run github:richban/system#sysdo <command>

bootstrap β€” First-time setup

Builds the initial system closure and activates it. On Darwin it also handles disk setup.

# macOS β€” auto-detected, uses default host
nix run .#sysdo bootstrap

# macOS β€” explicit host
nix run .#sysdo bootstrap melchior@aarch64-darwin

# Linux β€” explicit host (no darwin-rebuild present on Linux)
nix run .#sysdo bootstrap richban@x86_64-linux

# Build from the remote flake instead of local checkout
nix run .#sysdo bootstrap melchior@aarch64-darwin --remote

switch β€” Build & activate

The everyday update command. Rebuilds the configuration and activates it immediately.

# macOS β€” auto-detected
nix run .#sysdo switch

# macOS β€” explicit host
nix run .#sysdo switch melchior@aarch64-darwin

# Linux β€” auto-detected on non-Darwin systems
nix run .#sysdo switch richban@x86_64-linux

# Force a specific platform type
nix run .#sysdo switch melchior@aarch64-darwin --darwin
nix run .#sysdo switch richban@x86_64-linux --home-manager

# Apply from the published remote flake (no local clone needed)
nix run .#sysdo switch melchior@aarch64-darwin --remote

build β€” Build without activating

Builds the derivation and leaves a ./result symlink. Use this to validate changes before applying.

# macOS
nix run .#sysdo build melchior@aarch64-darwin

# Linux
nix run .#sysdo build richban@x86_64-linux

update β€” Update flake inputs

# Update all inputs
nix run .#sysdo update

# Update a single input
nix run .#sysdo update --flake nixpkgs
nix run .#sysdo update --flake home-manager
nix run .#sysdo update --flake neovim-nightly-overlay

# Commit the updated lockfile automatically
nix run .#sysdo update --commit

gc β€” Garbage collection

# Remove store paths older than 30 days
nix run .#sysdo gc --delete-older-than 30d

# Dry run β€” preview what would be removed
nix run .#sysdo gc --delete-older-than 14d --dry-run

clean β€” Remove build result symlinks

# Remove the default ./result symlink
nix run .#sysdo clean

# Remove all result symlinks in the current directory
nix run .#sysdo clean '*'

pull β€” Pull latest changes

Stashes local changes, pulls from remote, and re-applies the stash.

nix run .#sysdo pull

cache β€” Push derivations to Cachix

nix run .#sysdo cache richban

πŸ”§ Development Workflow

# Enter the dev shell (nixd, fd, ripgrep, uv + pre-commit hooks wired in)
nix develop

# Format all Nix files
nix fmt

# Run all checks β€” pre-commit hooks + build activation packages for all hosts
nix flake check

# Build specific flake outputs directly
nix build .#darwinConfigurations."melchior@aarch64-darwin".config.system.build.toplevel
nix build .#homeConfigurations."melchior@aarch64-darwin".activationPackage
nix build .#homeConfigurations."richban@x86_64-linux".activationPackage

Pre-commit hooks

Hooks run automatically inside the dev shell and during nix flake check:

Hook Purpose
alejandra Nix code formatting
black Python formatting (bin/do.py)
shellcheck Shell script linting
stylua Lua formatting (Neovim configs)
deadnix Dead Nix code removal

About

Nix system configurations and dotfiles

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors