Skip to content

Latest commit

 

History

History
106 lines (70 loc) · 3.54 KB

setup-new-generic-linux-machine.md

File metadata and controls

106 lines (70 loc) · 3.54 KB

Setup a new generic Linux machine

This document assumes that you have already installed a Linux distro in some way (e.g. using a USB stick).

SSH keypair

Generate an SSH keypair, start the SSH agent and store both public/private key on the computer.

ssh-keygen -t ed25519 -C "john.smith@acme.com"
eval $(ssh-agent -s)
ssh-add $HOME/.ssh/id_ed25519

Double check that the SSH agent has loaded the SSH key you have just generated.

ssh-add -l

Nix

Install Nix using the multi-user installation script.

sh <(curl -L https://nixos.org/nix/install) --daemon

Open a new terminal and very that Nix was installed correctly.

nix --version

Add the following to nix.conf (located at ~/.config/nix/nix.conf or /etc/nix/nix.conf).

experimental-features = nix-command flakes auto-allocate-uids

ℹ️ Setting experimental-features in nix.conf saves us from having to type --extra-experimental-features when running nix or nix flake commands.

Restart the nix daemon:

sudo systemctl restart nix-daemon.service

Git repository

Install git using the default package manager of your Linux distro (e.g. apt for Debian, Ubuntu, etc). I'm not sure why, but installing git using nix-env causes some conflicts with Home Manager.

sudo apt install git

Configure your name and email.

git config --global user.name "John Smith"
git config --global user.email "john.smith@acme.com"

Optional: create a directory for all of your repositories (e.g. mkdir ~/repos/).

Add the SSH public key to your GitHub account.

Clone the nix-config repository from GitHub using SSH.

git clone git@github.com:jackdbd/nix-config.git

Home Manager configuration

Install Home Manager using nix-env (read here if you have any issues on Ubuntu).

nix-env --install home-manager

From the root of this repository, apply only the Home Manager configuration for this host:

home-manager switch \
  --extra-experimental-features nix-command \
  --extra-experimental-features flakes \
  --extra-experimental-features auto-allocate-uids \
  --extra-experimental-features configurable-impure-env \
  --flake .#jack@l380

ℹ️ I think the flags --extra-experimental-features auto-allocate-uids and --extra-experimental-features configurable-impure-env are required by the google-chrome package. You can omit those --extra-experimental-features if you set experimental-features in nix.conf (see above).

Nix code formatter

Install alejandra downloading the x86_64-unknown-linux-musl prebuilt binary, making it executable and moving it to /usr/bin:

chmod +x alejandra-x86_64-unknown-linux-musl
sudo mv alejandra-x86_64-unknown-linux-musl /usr/bin/alejandra

OpenGL issues

If alacritty and kitty have some OpenGL issues, you might have to install/update Mesa drivers. It might be necessary to install these libraries.