dot
vizie's NixOS desktop: Hyprland, CachyOS kernel and gaming tweaks
897cb7d
5 files changed +96 −120
modifiedMIGRATION.md
@@ -1,127 +1,79 @@ | ||
| 1 | 1 | |
| 2 | 2 | |
| 3 | - | |
| 4 | - | |
| 5 | - | |
| 6 | - | |
| 7 | - | |
| 8 | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 9 | 8 | |
| 10 | - | |
| 11 | - | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 12 | 13 | |
| 13 | - | |
| 14 | + | |
| 14 | 15 | |
| 15 | -- | |
| 16 | -- | |
| 17 | - | |
| 18 | -- | |
| 19 | - | |
| 20 | - | |
| 16 | +- | |
| 17 | + | |
| 18 | + | |
| 21 | 19 | |
| 22 | 20 | |
| 23 | - | |
| 24 | - | |
| 25 | - | |
| 21 | + | |
| 22 | + | |
| 23 | +- | |
| 24 | + | |
| 26 | 25 | |
| 27 | - | |
| 28 | - | |
| 29 | - | |
| 30 | - | |
| 26 | + ```bash | |
| 27 | + sudo ~/git/dot/tools/backup-to-sata | |
| 28 | + ``` | |
| 31 | 29 | |
| 32 | - | |
| 33 | - | |
| 34 | - | |
| 30 | +- | |
| 31 | + | |
| 35 | 32 | |
| 36 | - | |
| 37 | - | |
| 33 | + ```bash | |
| 34 | + sudo install -d -m700 /root/.ssh && sudo nano /root/.ssh/authorized_keys | |
| 35 | + ``` | |
| 38 | 36 | |
| 39 | - | |
| 40 | - | |
| 41 | - | |
| 42 | - | |
| 43 | - | |
| 44 | - | |
| 45 | - | |
| 37 | + | |
| 46 | 38 | |
| 47 | - | |
| 48 | - | |
| 49 | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 50 | 43 | |
| 51 | 44 | |
| 52 | - | |
| 53 | - | |
| 54 | - | |
| 55 | - | |
| 56 | - | |
| 57 | - | |
| 45 | + | |
| 46 | + | |
| 58 | 47 | |
| 59 | 48 | |
| 60 | - | |
| 61 | - | |
| 49 | + | |
| 50 | + | |
| 62 | 51 | |
| 63 | 52 | |
| 64 | - | |
| 53 | + | |
| 65 | 54 | |
| 66 | 55 | |
| 67 | - | |
| 68 | - | |
| 69 | - | |
| 70 | - | |
| 71 | - | |
| 72 | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 73 | 61 | |
| 74 | - | |
| 75 | - | |
| 76 | - | |
| 77 | - | |
| 78 | - | |
| 79 | - | |
| 80 | - | |
| 81 | - | |
| 82 | - | |
| 83 | - | |
| 62 | + | |
| 84 | 63 | |
| 85 | - | |
| 86 | - | |
| 64 | + | |
| 87 | 65 | |
| 88 | 66 | |
| 89 | - | |
| 90 | - | |
| 91 | - | |
| 92 | - | |
| 93 | - | |
| 94 | - | |
| 95 | - | |
| 96 | - | |
| 97 | - | |
| 98 | - | |
| 99 | - | |
| 100 | - | |
| 101 | - | |
| 102 | - | |
| 103 | - | |
| 104 | - | |
| 105 | - | |
| 106 | - | |
| 107 | - | |
| 108 | - | |
| 109 | - | |
| 110 | - | |
| 111 | - | |
| 112 | - | |
| 113 | - | |
| 114 | - | |
| 115 | - | |
| 116 | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 117 | 72 | |
| 118 | 73 | |
| 119 | - | |
| 120 | - | |
| 121 | - | |
| 122 | - | |
| 74 | + | |
| 123 | 75 | |
| 124 | - | |
| 76 | + | |
| 125 | 77 | |
| 126 | 78 | - |
| 127 | 79 | - |
@@ -133,7 +85,7 @@ | ||
| 133 | 85 | `nix-index` (takes a few minutes). |
| 134 | 86 | - |
| 135 | 87 | |
| 136 | - | |
| 88 | + | |
| 137 | 89 | |
| 138 | 90 | |
| 139 | 91 | |
@@ -169,7 +121,7 @@ | ||
| 169 | 121 | - |
| 170 | 122 | |
| 171 | 123 | |
| 172 | - | |
| 124 | + | |
| 173 | 125 | |
| 174 | 126 | - |
| 175 | 127 | |
@@ -191,7 +143,7 @@ | ||
| 191 | 143 | - |
| 192 | 144 | |
| 193 | 145 | |
| 194 | - | |
| 146 | + | |
| 195 | 147 | |
| 196 | 148 | |
| 197 | 149 | |
modifiedhosts/desktop/default.nix
@@ -1,5 +1,10 @@ | ||
| 1 | 1 | # The desktop: ASUS TUF B850-PLUS, Ryzen 7 9850X3D, RTX 3080 Ti. |
| 2 | 2 | { inputs, ... }: |
| 3 | +let | |
| 4 | + # The MacBook's public SSH key (its ~/.ssh/id_ed25519.pub), see below. | |
| 5 | + macKeys = [ | |
| 6 | + ]; | |
| 7 | +in | |
| 3 | 8 | { |
| 4 | 9 | imports = [ |
| 5 | 10 | ./hardware-configuration.nix |
@@ -11,6 +16,12 @@ | ||
| 11 | 16 | |
| 12 | 17 | networking.hostName = "desktop"; |
| 13 | 18 | |
| 19 | + # The MacBook, which installs this machine with nixos-anywhere and can log in | |
| 20 | + # before the home folder (and its ~/.ssh/authorized_keys) is restored. Root | |
| 21 | + # too: a fresh install has no passwords, so that is how yours gets set. | |
| 22 | + users.users.vizie.openssh.authorizedKeys.keys = macKeys; | |
| 23 | + users.users.root.openssh.authorizedKeys.keys = macKeys; | |
| 24 | + | |
| 14 | 25 | home-manager = { |
| 15 | 26 | useGlobalPkgs = true; |
| 16 | 27 | useUserPackages = true; |
modifiedrestore-filter
@@ -1,5 +1,5 @@ | ||
| 1 | 1 | # rsync filter for restoring the home folder from the backup drive after the |
| 2 | -# install (MIGRATION.md, section 2). Only what is listed here comes back: the | |
| 2 | +# install (tools/restore-from-sata). Only what is listed here comes back: the | |
| 3 | 3 | # move to NixOS is a fresh start. Everything else stays on the backup drive, |
| 4 | 4 | # to copy back by hand if you miss it. The first matching line wins. |
| 5 | 5 | |
modifiedtools/backup-to-sata
@@ -1,8 +1,8 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | -# Backs up what MIGRATION.md section 1 lists to the Kingston SATA SSD (sda): | |
| 3 | -# the built system and disko script, WoW's settings and addons, and the home | |
| 4 | -# folder. Safe to run again: the first run formats the drive (only if it is | |
| 5 | -# empty), later runs only copy what changed. | |
| 2 | +# Backs up the home folder and WoW's settings and addons to the Kingston SATA | |
| 3 | +# SSD (sda), before the install wipes the NVMe drive (MIGRATION.md). Safe to | |
| 4 | +# run again: the first run formats the drive (only if it is empty), later runs | |
| 5 | +# only copy what changed. | |
| 6 | 6 | # |
| 7 | 7 | # sudo ~/git/dot/tools/backup-to-sata |
| 8 | 8 | set -euo pipefail |
@@ -11,11 +11,8 @@ | ||
| 11 | 11 | mnt=/mnt/backup |
| 12 | 12 | user=vizie |
| 13 | 13 | home=/home/$user |
| 14 | -repo=$home/git/dot | |
| 14 | +repo=$(dirname "$(dirname "$(readlink -f "$0")")") | |
| 15 | 15 | wow="$home/Games/battlenet/drive_c/Program Files (x86)/World of Warcraft/_retail_" |
| 16 | - | |
| 17 | -# sudo's PATH leaves out Nix (installed with the official installer here). | |
| 18 | -export PATH="$PATH:/nix/var/nix/profiles/default/bin" | |
| 19 | 16 | |
| 20 | 17 | if [ "$EUID" -ne 0 ]; then |
| 21 | 18 | echo "Run it with sudo: sudo $0" >&2 |
@@ -46,17 +43,7 @@ | ||
| 46 | 43 | if ! mountpoint -q "$mnt"; then |
| 47 | 44 | mount -o compress=zstd /dev/disk/by-label/backup "$mnt" |
| 48 | 45 | fi |
| 49 | -install -d -o "$user" "$mnt/nix-cache" "$mnt/wow" | |
| 50 | - | |
| 51 | -echo "== Saving the built system and the disko script" | |
| 52 | -sudo -u "$user" env PATH="$PATH" bash -euo pipefail -c ' | |
| 53 | - cd "$1" | |
| 54 | - sys=$(nix build --no-link --print-out-paths .#nixosConfigurations.desktop.config.system.build.toplevel) | |
| 55 | - disko=$(nix build --no-link --print-out-paths .#nixosConfigurations.desktop.config.system.build.diskoScript) | |
| 56 | - nix copy --to "file://$2/nix-cache?compression=zstd" "$sys" "$disko" | |
| 57 | - echo "$sys" > "$2/nix-cache/system" | |
| 58 | - echo "$disko" > "$2/nix-cache/disko" | |
| 59 | -' _ "$repo" "$mnt" | |
| 46 | +install -d -o "$user" "$mnt/wow" | |
| 60 | 47 | |
| 61 | 48 | echo "== WoW settings and addons" |
| 62 | 49 | rsync -a --delete "$wow/WTF" "$wow/Interface" "$mnt/wow/" |
@@ -1,0 +1,26 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Puts back what restore-filter lists from the backup drive into the new | |
| 3 | +# system's home folder (MIGRATION.md, step 3). Run it as root from the backup | |
| 4 | +# drive itself, mounted at /mnt: | |
| 5 | +# | |
| 6 | +# mount -o ro /dev/disk/by-label/backup /mnt | |
| 7 | +# /mnt/vizie/git/dot/tools/restore-from-sata | |
| 8 | +set -euo pipefail | |
| 9 | + | |
| 10 | +user=vizie | |
| 11 | +repo=$(dirname "$(dirname "$(readlink -f "$0")")") | |
| 12 | +backup=$(dirname "$(dirname "$repo")") | |
| 13 | + | |
| 14 | +if [ "$EUID" -ne 0 ]; then | |
| 15 | + echo "Run it as root." >&2 | |
| 16 | + exit 1 | |
| 17 | +fi | |
| 18 | +if [ ! -d "$backup/.ssh" ] || [ ! -f "$repo/restore-filter" ]; then | |
| 19 | + echo "$backup doesn't look like the home folder backup." >&2 | |
| 20 | + exit 1 | |
| 21 | +fi | |
| 22 | + | |
| 23 | +# Owned by you (uid 1000) and the users group (100), as NixOS sets them up. | |
| 24 | +rsync -aHAX --info=progress2 --chown=1000:100 \ | |
| 25 | + --filter="merge $repo/restore-filter" "$backup/" "/home/$user/" | |
| 26 | +echo "== Done. Log in on the desktop." |