From 89dfb0adb921ea3481987cae74f5ce626c4e7c2d Mon Sep 17 00:00:00 2001 From: andromeda Date: Tue, 30 Dec 2025 12:28:31 +0100 Subject: [PATCH] add README.md --- README.md | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..2aab043 --- /dev/null +++ b/README.md @@ -0,0 +1,123 @@ +## usage + +### install + +note: I have not tested the following verbatim. + +It *will* erase the contents of /dev/sdX. Use with caution. + +1. create usb with minimal NixOS iso + +2. boot from usb + +3. create partitions + +```console +$ #modern partition table +$ #WARNING all data on /dev/sdX will be erased. Make sure it is your target +$ parted /dev/sdX -- mklabel gpt +$ #make root partition +$ parted /dev/sdX -- mkpart ESP fat32 1MiB 512MiB +$ parted /dev/sdX -- set 1 esp on +$ #create store partition +$ parted /dev/sdX -- mkpart nix btrfs 512MiB 100GiB +$ #if your device is in english, use a period rather than a comma +$ parted /dev/sdX -- mkpart root btrfs 100GiB 199,5GiB +``` + +4. create filesystems + +```console +$ #make sure not to get your subvolumes mixed up +$ #there should be 3, the first boot and the others 99,5GiB each +$ fdisk -l +$ #boot partition +$ mkfs.fat -F 32 /dev/sdX1 +$ #store partition +$ mkfs.btrfs /dev/sdX2 +$ #root partition +$ mkfs.btrfs /dev/sdX3 +$ #create root subvolume +$ btrfs subvolume create /dev/sdX3/root +``` + +5. mount filesystems + +```console +$ #note the uuid of your disks +$ #they will be symlinked to something recognisable +$ #don't get them mixed up +$ ls -l /dev/disk/by-uuid +total 0 +lrwxrwxrwx 1 root root 15 Dez 30 11:31 0e586651-36f4-42b0-99b3-3f0704a894d6 -> ../../sdX2 +lrwxrwxrwx 1 root root 15 Dez 30 11:31 16c93673-4f0e-4010-a7f4-7ccffb20edb7 -> ../../sdX3 +lrwxrwxrwx 1 root root 15 Dez 30 11:31 F425-55BA -> ../../sdX1 +$ #now mount the appropriate filesystems using your uuids; these are mine +$ mount -o subvol-root /dev/disk/by-uuid/16c93673-4f0e-4010-a7f4-7ccffb20edb7 /mnt +$ mkdir -p /mnt/{boot,nix} +$ mount -o umask=077 /dev/disk/by-uuid/F425-55BA /mnt/boot +$ mount /dev/disk/by-uuid/0e586651-36f4-42b0-99b3-3f0704a894d6 /mnt/nix +``` + +6. prepare for installation + +```console +$ mkdir -p /mnt/etc/nixos +$ nixos-generate-config --root /mnt +$ cat /mnt/etc/nixos/hardware-configuration.nix +$ #note the random flags and stuff in hardware-configuration.nix; you might +$ #want to keep a copy around for the time being +$ rm /mnt/etc/nixos/* +$ #connect to the internet +$ nmtui +$ git clone https://git.mtgmonkey.net/andromeda/conf /mnt/etc/nixos +$ cd /mnt/etc/nixos +$ nix-shell -p tree --command tree +. +├── configuration.nix +├── flake.lock +├── flake.nix +├── machines +│   └── laptop +│   ├── hardware-configuration.nix +│   └── machine.nix +├── README.md +└── users + └── andromeda + ├── home.nix + └── stylix.nix + +5 directories, 8 files +$ #copy the `laptop` derivation and change all occurences of `laptop` with +$ #`your-machine` in `flake.nix` +$ cp machines/laptop machines/your-machine -r +$ #modify `machines/your-machine/hardware-configuration.nix` by changing the +$ #uuids to those of your drives +$ #also copy the flags and stuff from `hardware-configuration.nix` generated +$ #earlier +$ #change the hostname in `machines/your-machine/machine.nix` to your liking. +$ #If you want to pull request to my repo, `hostname` *must* be "your-machine" +$ #if you want a different user, edit `machines/your-machine/machine.nix` to +$ #reflect that. Create the file `users/your-user/home.nix` with your home +$ #manager configuration. Add your user's `impermanence` information in +$ #`configuration.nix` +$ #make sure to give your user an initalPassword, otherwise you won't be able +$ #to log in! Later, use a secrets scheme to have a real password +$ git add -A +``` + +7. install + +```console +$ cd /mnt/etc/nixos +$ nix flake check +$ #resolve any errors. You may have forgotten to add things to git, users, +$ #machines... +$ nixos-install --no-root-password --flake .#your-machine +``` + +8. reboot + +```console +$ systemctl reboot +```