This repo contains *.nix
files for configuring machines and
user homes, as well as some custom packages and overlays.
The naming scheme of files in os/host
is based on
the contents of /etc/machine-id
.
The following script illustrates the idea:
# This (re-)generates /etc/machine-id
systemd-machine-id-setup
# This function hashes /etc/machine-id, since it should be
# treated as a secret (according to the manpage).
function machine-hash {
nix-hash --type sha256 --base32 --flat /etc/machine-id
}
# Rebuild for current machine
nixos-rebuild switch --flake .#$(machine-hash)
Use wsl --import
to create the distro, then start it with wsl --distribution
.
Copy wsl.conf
from this repo to /etc/wsl.conf
.
Configure Nix via ~/.config/nix/nix.conf
:
sandbox = false
use-sqlite-wal = false
filter-syscalls = false
experimental-features = nix-command flakes
Install Nix in single-user mode:
$ sh <(curl -L https://nixos.org/nix/install) --no-daemon
Allow unfree packages in ~/.config/nixpkgs/config.nix
:
{ allowUnfree = true; }
Install Home Manager, then switch:
$ home-manager -v switch --show-trace --impure --flake .#wsl
Create /run/user/$UID
:
sudo mkdir /run/user/$UID
sudo chown $UID:$GID /run/user/$UID
sudo mount -t tmpfs -o size=4G,uid=$UID,gid=$GID /run/user/$UID
See NixOS Wiki. Gist is:
$ bluetoothctl
power on
agent on
default-agent
scan on
pair $ADDR
connect $ADDR
Address | Description |
---|---|
78:2B:64:CC:E4:40 |
Headset |
CE:B5:52:D6:EA:8C |
Trackball |
fdisk -c -u /dev/x
https://www.thomas-krenn.com/de/wiki/Partition_Alignment
https://www.ui.com/download/software/erlite3
https://github.com/jamesog/tailscale-edgeos
# For secure boot:
sudo systemd-cryptenroll /dev/$DISK --tpm2-device=auto --tpm2-pcrs=0+2+7
# Without secure boot:
sudo systemd-cryptenroll /dev/$DISK --tpm2-device=auto --tpm2-pcrs=0
# Removing key:
systemd-cryptenroll /dev/... --wipe-slot=tpm2
# Info
sudo cryptsetup luksDump /dev/...
# Check TPM
tpm2_getcap -l