Setup on bare metal
This runbook sets up the dev environment on your laptop or desktop. Follow the Arch installation guide.
Packages
-
Install base packages using pacman.
sudo pacman -S --needed sudo git openssh chezmoi base-develbase-develhas the build tools that step 2 needs. -
Install yay, the AUR helper.
git clone https://aur.archlinux.org/yay-bin.git cd yay-bin makepkg -si cd .. && rm -rf yay-binyay is a package manager for the AUR. It takes pacman’s commands, and it installs AUR packages that pacman cannot see. 1Password and its CLI are in the AUR, so yay installs them.
Linger
-
Enable linger for your user.
sudo loginctl enable-linger $USERXDG_RUNTIME_DIRis the directory for your session’s runtime files. systemd-logind creates it at login, and sets the variable for your session. The path is/run/user/plus your user ID, such as/run/user/1000for the first user.Without linger, the directory does not exist after you log out. The agent socket is absent.
The SSH key
-
Export the private key from the
Devices/jdoe_iditem on a different device. -
Paste the private key into the terminal on this machine.
( umask 077; cat > ~/.ssh/jdoe_id )Press Ctrl-D after the last line of the key.
-
Set the file mode to 0600.
chmod 600 ~/.ssh/jdoe_idThe subshell prevents a change to
umaskin the parent shell. If you setumaskwithout a subshell, the nextgit pullwrites each file that it changes as0600. -
Start the agent socket.
systemctl --user start ssh-agent.socket -
Add the key to the agent.
SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" ssh-add ~/.ssh/jdoe_idThe command prompts for the passphrase.
-
Check the key with GitHub.
ssh -T git@github.comThe output contains
Hi <user>!.Keep the copy on disk for a session where 1Password is not available. At each login,
op-keys.serviceloads the key from 1Password into the agent.
Apply the dotfiles
-
Run the
chezmoi initcommand.chezmoi init --apply ssh://git@git.jdoe-site.com:2222/home/git/dotfiles.gitThe URL contains the port number and the user name. This form does not need
~/.ssh/config. The command prompts for your name, your email, and the font size. The answers are kept for this machine. For an unattended installation, add--promptString.The command installs the package groups. The first installation is long. The
native:group contains the desktop, the Wayland stack, and the GPU drivers. After the installation, Hyprland starts when you log in on tty1.
The 1Password token
op-keys.service loads the key and the passphrase from 1Password at each login. It uses the
DevMachine service account. The token is a credential, and chezmoi does not manage it.
-
Create the token file.
( umask 077; mkdir -p ~/.config/op printf 'OP_SERVICE_ACCOUNT_TOKEN=%s\n' '<token>' > ~/.config/op/token.env ) -
Apply the dotfiles again.
chezmoi apply -
If the unit is not enabled, enable it manually.
systemctl --user enable --now op-keys.service -
Check the agent.
op-keys && ssh-add -lThe output is one line that ends with
jdoe_id.
tmux and Neovim
tmux runs every shell. ~/.bashrc contains exec tmux new-session. tmux opens session 0
for the first terminal and session 1 for the second. A session continues after you close
its terminal.
-
Start Neovim to install the treesitter parsers.
nvim -
Quit Neovim.
Type
:qand press Enter.
Neovim is the editor for vi and vim. Its keys are in neovim. The
shell keys are in terminal and workflow.
The desktop
-
Log out.
-
Log in on tty1. Hyprland starts.
The other TTYs open a shell in tmux. If the desktop configuration is incorrect, use one of these TTYs to get a shell.
Do not start Hyprland from inside tmux. The terminals of Hyprland get
$TMUXand do not start tmux.tmux kill-serverthen stops the desktop.The keys are in desktop.
Editing the dotfiles
chezmoi manages each file in your home directory. chezmoi shows the commands to edit a file and to check for changes that are not applied.
Verification
-
Open a file in the editor.
nvim ~/.bashrcNeovim shows the file.
-
Quit Neovim.
Type
:qand press Enter. -
List the tmux sessions.
tmux lsThe output shows session 0 and each session that you did not close.
-
Check the key with GitHub.
ssh -T git@github.comThe output contains
Hi <user>!.