DISKO
This commit is contained in:
340
README.md
340
README.md
@@ -1,121 +1,293 @@
|
||||

|
||||

|
||||
# Kris's Nix
|
||||
|
||||
# Keybind reference
|
||||
You should end up with:
|
||||
|
||||
| Keybind | What it does |
|
||||
| --------- | -------------------- |
|
||||
| `SUPER+Q` | Terminal |
|
||||
| `SUPER+C` | Close current window |
|
||||
| `SUPER+E` | File Manager |
|
||||
| `SUPER+V` | Toggle Floating |
|
||||
| `SUPER+Q` | Terminal |
|
||||
| `SUPER+T` | App Launcher |
|
||||
| `SUPER+P` | Psuedo |
|
||||
| `SUPER+J` | Toggle Split |
|
||||
| `SUPER+F` | Fullscreen |
|
||||
- NixOS using this repo from `/etc/nixos`
|
||||
- the automatically-created user `kris`
|
||||
- the default desktop config from this flake
|
||||
|
||||
| Keybind | What it does |
|
||||
| ------------------ | ------------------ |
|
||||
| `SUPER+RightArrow` | Move Focus (right) |
|
||||
| `SUPER+LeftArrow` | Move Focus (left) |
|
||||
| `SUPER+DownArrow` | Move Focus (down) |
|
||||
| `SUPER+UpArrow` | Move Focus (up) |
|
||||
## What This Repo Does
|
||||
|
||||
| Keybind | What it does |
|
||||
| ------------------------ | ------------------ |
|
||||
| `SUPER+SHIFT+RightArrow` | Window width +100 |
|
||||
| `SUPER+SHIFT+LeftArrow` | Window width -100 |
|
||||
| `SUPER+SHIFT+DownArrow` | Window height +100 |
|
||||
| `SUPER+SHIFT+UpArrow` | Window height -100 |
|
||||
This repo configures:
|
||||
|
||||
| Keybind | What it does |
|
||||
| ----------------------- | ----------------------- |
|
||||
| `SUPER+CTRL+RightArrow` | Swap window pos (right) |
|
||||
| `SUPER+CTRL+LeftArrow` | Swap window pos (left) |
|
||||
| `SUPER+CTRL+UpArrow` | Swap window pos (down) |
|
||||
| `SUPER+CTRL+DownArrow` | Swap window pos (up) |
|
||||
- the default desktop machine
|
||||
- a separate server host
|
||||
|
||||
| Mouse Keybind | What it does |
|
||||
| ------------------ | -------------- |
|
||||
| `SUPER+MouseLeft` | Move window |
|
||||
| `SUPER+MouseRight` | Resize window |
|
||||
| `SUPER+ScrollUp` | Next workspace |
|
||||
| `SUPER+ScrollDown` | Prev workspace |
|
||||
DO NOT use `#server`, this build the server!
|
||||
|
||||
| Keybind | What it does |
|
||||
| ------------------- | ---------------------------------------- |
|
||||
| `SUPER+[0-9]` | Switch to workspace X |
|
||||
| `SUPER+SHIFT+[0-9]` | Move active window to workspace X |
|
||||
| `SUPER+Z` | Special workspace |
|
||||
| `SUPER+SHIFT+Z` | Move current window to special Workspace |
|
||||
## Before You Start
|
||||
|
||||
| Keybind | What it does |
|
||||
| --------------- | ---------------- |
|
||||
| `SUPER+SHIFT+B` | Reload Waybar |
|
||||
| `CTRL+ALT+DEL` | WLogout |
|
||||
| `FN+F5` | Prev music track |
|
||||
| `FN+F6` | Next music track |
|
||||
| `FN+F7` | Play/Pause music |
|
||||
You need:
|
||||
|
||||
| Keybind | What it does |
|
||||
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
||||
| `SUPER+SHIFT+ENTER` | Change wallpaper |
|
||||
| `SUPER+F1` | Hide waybar |
|
||||
| `SUPER+F2` | [Roblox](https://roblox.com) [Roblox](https://sober.vinegarhq.org) |
|
||||
| `SUPER+Space` | Switch Keyboard Layout (English, Latvian) |
|
||||
- a NixOS installer
|
||||
- internet access
|
||||
- your disks partitioned and mounted
|
||||
- this repo _(`git@tangled.sh:kris.darkworld.download/nix`)_
|
||||
|
||||
## How to install NixOS
|
||||
## Disk Layout
|
||||
|
||||
1. Install base NixOS from the commandline
|
||||
This repo now uses `disko` for the default desktop host.
|
||||
|
||||
- Without UI
|
||||
- Use this disk configuration
|
||||
The current declarative layout is:
|
||||
|
||||
```
|
||||
/dev/sda1 - 1G fat32 fmask=0022 dmask=0022 vfat
|
||||
mounts to /boot
|
||||
|
||||
# add compress=zstd
|
||||
|
||||
/dev/sdb2 - 100% btrfs, with these subvolumes:
|
||||
root -> /
|
||||
[noatime] nix -> /nix
|
||||
home -> /home
|
||||
root -> /root
|
||||
```text
|
||||
disk = /dev/nvme0n1
|
||||
ESP = 2G FAT32 mounted at /boot
|
||||
root disk = remaining space as btrfs
|
||||
subvols = /, /home, /nix
|
||||
```
|
||||
|
||||
2. Create user named `kris`
|
||||
Mount options are declared in the disko config:
|
||||
|
||||
3. Run this in order:
|
||||
- `/` with `compress=zstd`
|
||||
- `/home` with `compress=zstd`
|
||||
- `/nix` with `compress=zstd,noatime`
|
||||
|
||||
If `/dev/nvme0n1` is not the disk you want to wipe and install to, edit [`hosts/default/disko.nix`](/home/ralsei/config/hosts/default/disko.nix) before running the installer.
|
||||
|
||||
RAHHHHH IM NOT WRITING STUFF ANYMORE PLZ JUST TRY TO FIGURE OUT THE STEPS URSELF
|
||||
THX
|
||||
|
||||
## Fresh Install
|
||||
|
||||
### 1. Boot the NixOS installer
|
||||
|
||||
Use the normal installer ISO.
|
||||
|
||||
### 2. Clone the repo in the installer
|
||||
|
||||
From the live installer:
|
||||
|
||||
```bash
|
||||
cd ~
|
||||
nix-shell -p git
|
||||
rm -rf /etc/nixos
|
||||
git clone git@tangled.sh:kris.darkworld.download/nix /etc/nixos
|
||||
```
|
||||
|
||||
4. Run this inside the `nix-shell`
|
||||
### 3. Let disko partition and mount the target disk
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
git clone git@tangled.sh:kris.darkworld.download/nix /tmp/nix-config
|
||||
sudo rm -rf /etc/nixos
|
||||
sudo mv /tmp/nix-config /etc/nixos
|
||||
cd /etc/nixos
|
||||
sudo nixos-rebuild switch --flake /etc/nixos#default --cores 20
|
||||
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/disko -- --mode destroy,format,mount /etc/nixos#default
|
||||
```
|
||||
|
||||
1. Reboot, run this in your terminal:
|
||||
This will:
|
||||
|
||||
- partition the disk
|
||||
- format it
|
||||
- create the btrfs subvolumes
|
||||
- mount everything under `/mnt`
|
||||
|
||||
This is destructive.
|
||||
|
||||
### 4. Generate hardware config
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
nixos-generate-config --root /mnt
|
||||
```
|
||||
|
||||
Then replace the generated target config with this repo while keeping the generated hardware file:
|
||||
|
||||
```bash
|
||||
cp /mnt/etc/nixos/hardware-configuration.nix /tmp/hardware-configuration.nix
|
||||
rm -rf /mnt/etc/nixos
|
||||
git clone git@tangled.sh:kris.darkworld.download/nix /mnt/etc/nixos
|
||||
cp /tmp/hardware-configuration.nix /mnt/etc/nixos/hardware-configuration.nix
|
||||
```
|
||||
|
||||
## Install The System
|
||||
|
||||
### 5. Run the install
|
||||
|
||||
From the live environment:
|
||||
|
||||
```bash
|
||||
nixos-install --flake /mnt/etc/nixos#default
|
||||
```
|
||||
|
||||
If Nix complains about flakes:
|
||||
|
||||
```bash
|
||||
nix --extra-experimental-features 'nix-command flakes' run nixpkgs#nixos-install -- --flake /mnt/etc/nixos#default
|
||||
```
|
||||
|
||||
### 6. Reboot
|
||||
|
||||
After install finishes:
|
||||
|
||||
```bash
|
||||
reboot
|
||||
```
|
||||
|
||||
## First Boot
|
||||
|
||||
### 7. Log in as `kris`
|
||||
|
||||
The config creates the main user for you during install.
|
||||
|
||||
After boot, log into the installed system as:
|
||||
|
||||
```text
|
||||
kris
|
||||
```
|
||||
|
||||
### 8. Verify the repo location
|
||||
|
||||
Make sure the config is really here:
|
||||
|
||||
```bash
|
||||
ls /etc/nixos
|
||||
```
|
||||
|
||||
You should see:
|
||||
|
||||
- `flake.nix`
|
||||
- `flake.lock`
|
||||
- `hosts`
|
||||
- `modules`
|
||||
|
||||
### 9. Rebuild once from the installed system
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake /etc/nixos#default
|
||||
```
|
||||
|
||||
## Manual Restore After Install
|
||||
|
||||
Nix does not fully restore everything by itself. Some things still need to be
|
||||
copied back manually.
|
||||
|
||||
### 10. Recreate normal user folders
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
mkdir -p /home/kris/Pictures
|
||||
mkdir -p /home/kris/Pictures/Screenshots
|
||||
mkdir -p /home/kris/Pictures/Wallpapers
|
||||
mkdir -p /home/kris/Pictures/Deltarune
|
||||
mkdir -p /home/kris/Downloads
|
||||
mkdir -p /home/kris/Desktop
|
||||
mkdir -p /home/kris/Documents
|
||||
mkdir -p /home/kris/Projects
|
||||
```
|
||||
|
||||
6. Add this to `/etc/resolv.conf` as root
|
||||
### 11. Restore Quickshell project
|
||||
|
||||
This config expects the Deltarune Quickshell project here:
|
||||
|
||||
```text
|
||||
/home/kris/Projects/DeltaruneQuickshell
|
||||
```
|
||||
nameserver 1.1.1.1
|
||||
|
||||
If it is missing, restore or clone it there.
|
||||
|
||||
### 12. Restore non-declarative assets
|
||||
|
||||
Copy back these if you want the setup to look correct:
|
||||
|
||||
- `~/Pictures/Wallpapers`
|
||||
- `~/Pictures/Deltarune`
|
||||
- `~/.local/share/fonts`
|
||||
- `~/.local/share/icons`
|
||||
- `~/.local/share/deltarunequickshell`
|
||||
|
||||
Important:
|
||||
|
||||
- screenshots are optional
|
||||
- the desktop can boot without all of this, but it will not look right
|
||||
|
||||
### 13. Restore private assets and secrets
|
||||
|
||||
If you use them, restore things like:
|
||||
|
||||
- SSH keys
|
||||
- Git auth
|
||||
- cloudflare credentials
|
||||
- Bitwarden/KeePass databases
|
||||
- any private art or shell assets
|
||||
|
||||
## Useful Commands
|
||||
|
||||
Rebuild:
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch --flake /etc/nixos#default
|
||||
```
|
||||
|
||||
Update flake inputs:
|
||||
|
||||
```bash
|
||||
cd /etc/nixos
|
||||
nix flake update
|
||||
```
|
||||
|
||||
Check current git state:
|
||||
|
||||
```bash
|
||||
git -C /etc/nixos status
|
||||
```
|
||||
|
||||
## If Something Is Broken
|
||||
|
||||
### Quickshell missing
|
||||
|
||||
Make sure:
|
||||
|
||||
- the package is installed by Nix
|
||||
- `/home/kris/Projects/DeltaruneQuickshell` exists
|
||||
|
||||
### Rice looks wrong
|
||||
|
||||
You probably forgot to restore:
|
||||
|
||||
- fonts
|
||||
- icons/cursors
|
||||
- wallpapers
|
||||
- Quickshell runtime state
|
||||
|
||||
### Build fails because of hardware config
|
||||
|
||||
Make sure this file exists:
|
||||
|
||||
```text
|
||||
/etc/nixos/hardware-configuration.nix
|
||||
```
|
||||
|
||||
### Git push fails
|
||||
|
||||
Your local SSH config may be cursed. If needed, bypass system SSH config:
|
||||
|
||||
```bash
|
||||
git -c core.sshCommand='ssh -F /dev/null' push
|
||||
```
|
||||
|
||||
## TL;DR
|
||||
|
||||
If you want the shortest version:
|
||||
|
||||
```bash
|
||||
nix-shell -p git
|
||||
rm -rf /etc/nixos
|
||||
git clone git@tangled.sh:kris.darkworld.download/nix /etc/nixos
|
||||
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/disko -- --mode destroy,format,mount /etc/nixos#default
|
||||
nixos-generate-config --root /mnt
|
||||
cp /mnt/etc/nixos/hardware-configuration.nix /tmp/hardware-configuration.nix
|
||||
rm -rf /mnt/etc/nixos
|
||||
git clone git@tangled.sh:kris.darkworld.download/nix /mnt/etc/nixos
|
||||
cp /tmp/hardware-configuration.nix /mnt/etc/nixos/hardware-configuration.nix
|
||||
nixos-install --flake /mnt/etc/nixos#default
|
||||
reboot
|
||||
```
|
||||
|
||||
Then restore:
|
||||
|
||||
- `/home/kris/Projects/DeltaruneQuickshell`
|
||||
- `~/.local/share/fonts`
|
||||
- `~/.local/share/icons`
|
||||
- your wallpapers and pictures
|
||||
|
||||
Reference in New Issue
Block a user