Nix configuration for my NixOS and nix-darwin hosts
Find a file
2025-11-06 06:35:54 +01:00
config move font config file 2025-11-06 06:35:54 +01:00
hosts/nixos move font config file 2025-11-06 06:35:54 +01:00
modules move font config file 2025-11-06 06:35:54 +01:00
scripts Remove container updater 2025-10-12 11:25:46 +02:00
.gitignore Remove auto-generated projects.json from git tracking 2025-07-27 18:08:00 +02:00
flake.lock update claude code 2025-11-02 12:12:56 +01:00
flake.nix add deck base config 2025-10-28 18:37:44 +01:00
README.md add host install commands 2025-11-04 20:37:21 +01:00

Nix Configuration

Flake-based NixOS configuration with home-manager.

Commands

Daily Use

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

# Home Manager
home-manager switch --flake .#yanlin@<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

# 1. Initialize disk with disko
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko --flake .#<host>

# 2. Install NixOS
sudo nixos-install --flake .#<host>

Occasional Commands

# Garbage collection
nix-collect-garbage -d
sudo nix-collect-garbage -d

# Check flake
nix flake check
nix flake show

# Search packages
nix search nixpkgs <package>

# Rollback
sudo nixos-rebuild switch --rollback

# Build without switching
nixos-rebuild build --flake .#<host>

Structure

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

Workflows

Project Management

proj - Launch tmux sessions from config/projects.json

Quick Aliases

  • hms - Rebuild home-manager
  • oss - Rebuild NixOS system
  • cdf - Interactive file search with cd
  • pwdf - Get file path interactively

Tmux Reminders

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

Service Management (NixOS)

# Check service status
systemctl status <service>
journalctl -u <service> -f

# Container management
podman ps  # Actually podman
podman logs <container>
podman exec -it <container> bash

# Systemd timers
systemctl list-timers