Debian testing / X1 Nano G2 setup notes
7 March, 2024I recently picked up a second ThinkPad X1 Nano, a Gen 2 device, ostensibly to replace my older but much loved Gen 1 machine. It doesn’t really need replacing since it’s still a great little machine and easily my preferred laptop when travelling, but the deal I found for the Gen 2 was too good to pass up so here we are.
Both this and the G1 run flawlessly under Linux; Everything is supported - even firmware updates, it’s relatively power-efficient (I’m aware that the G2 isn’t as good in this regard), and fast despite a relatively weedy CPU.
This time I thought I’d dump some notes on how I configure Debian on my machines, as well as anything specific required for this device.
Hardware
It’s basically the ‘poverty’ spec model with an Intel i5-1240P CPU, 16GB RAM, and a 256GB disk. All fine apart from the disk, fortunately this is one of the parts that is user-servicable and thus upgradeable. Unfortunately it’s a 2242 NVMe and a single-sided one at that which as it turns out are pretty rare. The good news is that you can instead fit a 2230 - which are in plentiful single-sided supply - if you use a simple adapter 1. I ordered that plus a 1TB Corsair MP600 since the reviews for this drive were positive for both performance as well as power consumption.
The other key upgrade is replacing the default TrackPoint cap with one of these.
At that point it was ready for a nice fresh install of Debian. Here’s some rough notes.
Install
Guided, but then delete default /
, swap
, and /home
.
- Add
120GB root
- Create encrypted volume for remainder
- Create partition in encrypted volume for
/home
- Do not add swap (we’ll add a swap file post install)
Update to testing
If you’ve not used the installer for testing, then:
Edit /etc/apt/sources.list
and change all bookworm
references to testing
sudo apt-get update
sudo apt-get -y dist-upgrade
Reboot once done.
Reconfigure Terminal font
sudo dpkg-reconfigure console-setup
UTF8 - Latin1 - Terminus - 14x28 FB only
Liquorix kernel:
curl -s 'https://liquorix.net/install-liquorix.sh' | sudo bash
Setup swapfile
sudo fallocate -l 8G /.swap
sudo mkswap /.swap
sudo chmod 0600 /.swap
Line for fstab
:
/.swap none swap sw 0 0
Then swapon -a
.
Packages
Add contrib
to /etc/apt/sources.list
git
curl
build-essential
imwheel
btop
syncthing
neovim
zsh
flatpak
gnupg2
powertop
ttf-mscorefonts-installer
gnome-software-plugin-flatpak
libssl-dev
Flatpak
https://flatpak.org/setup/Debian:
sudo apt install flatpak
sudo apt install gnome-software-plugin-flatpak
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
Then install Newsflash and Obsidian from GNOME Software Store
Commercial
1Password: https://1password.com/downloads/linux/
Chrome: https://www.google.com/intl/en_uk/chrome/dr/download/
Slack: https://slack.com/intl/en-gb/downloads/linux
Kubernetes
kubectl:
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
Krew:
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
Then plugins:
kubectl krew install {ctx,ns,who-can,view-allocations,stern,tree}
And finally Kubie for quickly switching kubeconfigs:
wget -O ~/bin/kubie https://github.com/sbstp/kubie/releases/download/v0.23.0/kubie-linux-amd64
chmod +x ~/bin/kubie
Programming Languages
Go
Download from https://go.dev/doc/install, then:
sudo tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz
Pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src
pyenv install 3.12.2
pyenv global 3.12.2
And then some Python packages:
OpenStack
pip install python-{openstack,neutron,nova,octavia,swift,ironic}client
Ansible
pip install -U ansible ansible-lint
Rbenv
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
sudo apt -y install libyaml-dev
rbenv install 3.3.0
rbenv global 3.3.0
Neovim
Grab the latest release and extract:
wget https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
sudo tar zxvf nvim-linux64.tar.gz --strip-components=1 -C /usr/local
Helix
Grab the latest release from https://github.com/helix-editor/helix and extract to ~/bin.
This repo provides useful configuration options when you’re used to vim.
Vistual Studio Code
sudo apt-get install wget gpg
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
rm -f packages.microsoft.gpg
sudo apt install apt-transport-https
sudo apt update
sudo apt install code
Docker
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
bookworm stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Shell setup and dotfiles
Install zgen:
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
I typically copy across my shell’s .history
(yes I know I should use something like Atuin) and git clone
my dotfiles, symlinking various things into place.
GNOME Settings and Extensions
Via gnome-tweaks:
- Display - set to 100% for scale
- Font scale: 1.25
- Set Caps Lock to act as Control
- Right mouse button should resize windows
General settings:
- Increase mouse pointer size (Accessibilty - Seeing - Cursor size - medium)
- Disable animations (makes GNOME feel super snappy)
- Set ‘Super+D’ to ‘Hide all normal windows’
Extensions
I only install a handful of extensions in GNOME, mostly to hide a few extraneous items from the status bar:
I don’t believe in using anything like Dash-to-dock, instead relying on shortcut keys for my three most important apps (Terminal, Chrome, and Slack) and also the overview plus alt-tab to navigate my way around.
Remove default Music, Pictures etc. dirs from Files
To hide these sections, edit ~/.config/user-dirs.dirs
and set the directory to be $HOME
, for example:
XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME"
XDG_PUBLICSHARE_DIR="$HOME"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME"
XDG_PICTURES_DIR="$HOME"
XDG_VIDEOS_DIR="$HOME"
Got black and white Emojis?
Unlink 70-no-bitmaps.conf
from /etc/fonts/conf.d
Syncthing
mkdir -p .config/systemd/user
cd ~/.config/systemd/user
wget https://raw.githubusercontent.com/syncthing/syncthing/master/etc/linux-systemd/user/syncthing.service
systemctl --user enable syncthing.service
systemctl start --user syncthing
journalctl -f --user -u syncthing
Then jump through the hoops to get it to sync with my Synology NAS.
Terminal
I use Gogh to quickly import some profiles into Gnome Terminal, in particular GitHub Light and GitHub Dark. However, before any profiles appear you need to create a new profile called ‘Default’ and delete the ‘Unnamed’ one. Basically follow the steps in this issue: https://github.com/Gogh-Co/Gogh/issues/63#issuecomment-401510226.
I then rebind keys in Terminal so that Super+c is copy and Super+v is paste.
Appearance
I like to stick to the default where possible so I don’t change much else. I think GNOME looks great as it is.