Skip to content

dbeley/nixos-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nixos-config

NixOS Unstable

t470s

Type Program
Shell: fish, zsh
DM: tty1
WM: hyprland, sway, niri (+ waybar), gnome
Editor: doom-emacs / neovim / helix / kakoune
Terminal: ghostty / kitty
Launcher: tofi
Browser: firefox / qutebrowser
Theme: stylix

Notable Features

Hosts

  • p14s: my main laptop (Lenovo ThinkPad P14s Gen 4: AMD Ryzen 7 7840U, 16GB RAM, hyprland)
  • x1yoga: my secondary laptop (Lenovo ThinkPad X1 Yoga Gen 5: Intel Core i5-10210U, 8GB RAM, hyprland + touch gestures w/ hyprgrass, impermanence)
  • sg13: my main desktop computer (Silverstone SG13: AMD Ryzen 5 2600, RX 580 8GB, 16GB RAM, gnome)
  • x61s: my retro laptop (Lenovo Thinkpad X61s: Intel Core 2 Duo L7500, 3GB RAM, sway)
  • x13: my previous main laptop (Lenovo ThinkPad X13 Gen 1: AMD Ryzen 5 4650U, 16GB RAM, hyprland, impermanence)

Common Usage

Rebuild the system

sudo nixos-rebuild switch --flake .#{host}
sudo nixos-rebuild switch --flake .#{host} --target-host root@<ip address> # for a remote host

Delete unused packages

sudo nix-collect-garbage -d # for system packages
nix-collect-garbage -d # for home-manager packages

Optimise store

nix-store --optimise -v

just

A justfile is provided, see https://github.com/casey/just for more information.

just switch
just clean

For the recipes to work properly, create a .env and fill it with the needed environment variables:

HOST=x13

Install

On a new install, you should first copy /etc/nixos/hardware-configuration.nix over hosts/{host}/hardware-configuration.nix.

Impermanence

Installation can be done from any computer running nix, using a live ISO running from a USB key is not recommended as it will most likely run out of space during the install. The target disk can be any mounted disk (except the one the system is currently running on!) and will then have to be installed on the host compuster after the installation is complete. :

# On a new host don't forget to generate the hardware-configuration.nix file and copy it on hosts/{host}/hardware-configuration.nix
nixos-generate-config --no-filesystems

# disko + impermanence install on an existing host called "x1yoga"
sudo nix run 'github:nix-community/disko/latest#disko-install' -- --flake .#x1yoga --disk main /dev/sda --show-trace
# Using just
just first-install-disko x1yoga /dev/sda

# Post-installation - mount the newly installed system on /mnt/root
lsblk # identify luks encrypted partition
sudo cryptsetup open /dev/sda2 luks-1
sudo mount -o subvol=root /dev/mapper/luks-1 /mnt/root
sudo mount -o subvol=persistent /dev/mapper/luks-1 /mnt/root/persistent  
sudo mount -o subvol=nix /dev/mapper/luks-1 /mnt/root/nix
sudo mount /dev/sda1 /mnt/root/boot

# Create password file
mkpasswd > temp_passwd_file
sudo mv temp_passwd_file /mnt/root/persistent/passwd_$USER
sudo chown root:root /mnt/root/persistent/passwd_$USER

# Optional: chroot into the new system to apply other changes
sudo nixos-enter --root /mnt

Post-install

For doom-emacs:

git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
~/.config/emacs/bin/doom install

TODO

Some tools and utilities to test

  • sops-nix
  • nixos-generators
  • git-hooks
  • nh
  • cachix