Nix configuration for my NixOS and nix-darwin hosts
Find a file
2026-02-14 10:13:15 +01:00
config adjust video codec 2026-02-14 09:15:35 +01:00
hosts update host IP addresses 2026-02-14 10:13:15 +01:00
modules update host IP addresses 2026-02-14 10:13:15 +01:00
.gitignore remove custom project launcher 2026-01-13 14:35:25 +01:00
CLAUDE.md minor fix 2025-12-09 01:53:42 +01:00
flake.lock update flake 2026-02-14 06:31:51 +01:00
flake.nix update flake 2026-02-10 07:52:59 +01:00
README.md cleanup homebrew list 2026-01-30 06:43:48 +01:00

Nix Configuration

Flake-based NixOS configuration with home-manager.

Commands

Daily Use

# System rebuild
sudo nixos-rebuild switch --flake .#<host>  # NixOS
sudo darwin-rebuild switch --flake .#<host>  # Nix-darwin
# or use alias: oss

# Home Manager
home-manager switch --flake .#<user>@<host>
# or use alias: hms
# the full switch alias `fs` will perform system rebuild then home manager switch

# Update flake
nix flake update

New Host Installation

# For NixOS and disko
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko --flake github:Logan-Lin/nix-config#<host>
sudo nixos-install --flake .#<host>

# For nix-darwin
xcode-select --install
sudo nix --extra-experimental-features "nix-command flakes" run nix-darwin -- switch --flake github:Logan-Lin/nix-config#<host>
nix --extra-experimental-features "nix-command flakes" run home-manager/master -- switch --flake github:Logan-Lin/nix-config#<user>@<host>

Occasional Commands

# Garbage collection
nix-collect-garbage -d
sudo nix-collect-garbage -d
brew cleanup --prune=all

# Check flake
nix flake check
nix flake show

# Search packages
nix search nixpkgs <package>

# Rollback
sudo nixos-rebuild switch --rollback

Structure

.
├── flake.nix           # Entry point
├── hosts/
│   ├── nixos/          # NixOS configurations
│   │   ├── system-default.nix
│   │   ├── home-default.nix
│   │   └── <host>/
│   └── darwin/         # Nix-darwin configurations
│       ├── system-default.nix
│       ├── home-default.nix
│       └── <host>/
├── modules/            # Reusable modules
├── config/             # Static config files
└── scripts/            # Helper scripts

Workflows

Quick Aliases

  • hms - Rebuild home-manager
  • oss - Rebuild NixOS system
  • cdf - Interactive file search with cd
  • pwdf - Get file path interactively
  • fm - Open current directory in GUI file manager

Tmux Reminders

  • Prefix: Ctrl-a
  • Split: | and -
  • Navigate: hjkl
  • Resize: HJKL

Service Management

# Container services
sudo systemctl start/stop/restart podman-<container>.service
sudo systemctl status podman-<container>.service
sudo journalctl -u podman-<container>.service -f  # Follow logs
sudo journalctl -u podman-<container>.service -n 100  # Last 100 lines

# Podman commands
sudo podman ps -a
sudo podman logs -f <container>
sudo podman exec -it <container> bash

# Other services
systemctl status <service>
journalctl -u <service> -f
systemctl list-timers