This repo has been migrated to ~weitanism/nixos-config.
My personal NixOS flake repo.
This project is structured as follows:
flake.nix
: flake filemachine
: configuration for desktopsserver
: configuration for serversuser
: configuration for users(home-manager)lib
: common utility nix functionpkgs
: custom packagesoverlay
: overlays
My custom keybinds:
Alt-o
: app launcherAlt-Shift-q
: kill current window/appAlt-h/j/k/l
: focus left/lower/upper/right windowAlt-Shift-h/j/k/l
: move focused window to left/lower/upper/rightAlt-[1-9]
: switch to workspace [1-9]Alt-p
: power menu(lock, poweroff, hibernate, etc.)Alt-Enter
: open new terminalAlt-Shift-Enter
: open new emacsclientAlt-u
: emoji selector
Note: complete list of keybind can be found at
user/weitan/i3/config
.
- Partition, format and mount the disk(copied from NixOS official document):
# Partition the disk. # NOTE: replace /dev/sda with /dev/nvme0n1 if using a SSD. parted /dev/sda -- mklabel gpt parted /dev/sda -- mkpart primary 512MB -8GB parted /dev/sda -- mkpart primary linux-swap -8GB 100% parted /dev/sda -- mkpart ESP fat32 1MB 512MB parted /dev/sda -- set 3 esp on # Formatting the disk. # NOTE: replace /dev/sdaX with /dev/nvme0n1pX if using a SSD. mkfs.ext4 -L nixos /dev/sda1 mkswap -L swap /dev/sda2 swapon /dev/sda2 mkfs.fat -F 32 -n boot /dev/sda3 mount /dev/disk/by-label/nixos /mnt mkdir -p /mnt/boot mount /dev/disk/by-label/boot /mnt/boot
- Run
nixos-generate-config --root /mnt
to generate hardware configuration - Create config folder for new machine
# First, drop to a shell with `git` available nix-shell -p git # Clone the repo git clone https://github.com/weitanism/nixos-config.git /tmp/nixos pushd /tmp/nixos # Create machine config directory from template cp -a machine/template machine/<your-machine-name> # Copy hardware specific config files created in step 2 cp -a /mnt/etc/nixos/{configuration.nix,hardware-configuration.nix} machine/<your-machine-name>/ git add machine/<your-machine-name>/ popd
- Add a system config entry to
nixosConfigurations
in flake.nix, example:# A system named "framework" with "x86_64" CPU and default username # "weitan"(will load user home-manager config defined in # `user/weitan/home.nix`). (mkSystem { hostname = "framework"; username = "weitan"; system = "x86_64-linux"; })
- Build your system
nixos-install --flake /tmp/nixos#<your-machine-name>
- Replace default configuration directory
rm -r /mnt/etc/nixos mv /tmp/nixos /mnt/etc/nixos
- Reboot
Software enabled on my laptop for daily work:
- window manager: i3
- status bar: polybar
- editor: Emacs with evil-mode
- app launcher: rofi
Self-hosted services:
- Framework
- CPU: 12th Gen Intel i7-1260P (16) @ 4.700GHz
- Memory: 64GiB
- Storage: 1TiB SSD
- ThinkPad X1 Nano Gen 1
- CPU: 11th Gen Intel i7-1160F7 (8) @ 4.4000GHz
- Memory: 16GiB
- Storage: 1TiB SSD
- VPS(DigitalOcean) for self-hosted services
- Type: Basic
- CPU: 1vCPU
- Memory: 512MB
- Storage: 0.5TiB SSD