wip on foureighty reinstall

This commit is contained in:
Cyryl Płotnicki 2021-06-26 18:55:09 +01:00
parent 64dc7eec8a
commit cd779e7fa4
2 changed files with 53 additions and 16 deletions

View file

@ -7,7 +7,7 @@ Mostly focusing on setting things up on NixOS, but supporting other OSes where p
2. change password for the default user `nixos`
3. ssh from another, already bootstrapped, machine
remote:
remote (sata):
```bash
sudo su -
@ -23,13 +23,34 @@ parted /dev/sda -- mkpart primary 1GiB 100%
cryptsetup luksFormat /dev/sda2
```
remote:
remote (nvme):
```bash
sudo su -
# `efibootmgr -b 000x -B` if you want to remove entry number x
yes | parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- rm 1
parted /dev/nvme0n1 -- rm 2
parted /dev/nvme0n1 -- rm 3
parted /dev/nvme0n1 -- rm 4
parted /dev/nvme0n1 -- mkpart ESP fat32 1MiB 1GiB
parted /dev/nvme0n1 -- set 1 esp on
parted /dev/nvme0n1 -- mkpart primary 1GiB 100%
cryptsetup luksFormat /dev/nvme0n1p2
```
remote (sata):
```bash
cryptsetup luksOpen /dev/sda2 crypt
```
remote:
remote (nvme):
```bash
cryptsetup luksOpen /dev/nvme0n1p2 crypt
```
remote (sata):
```bash
mkfs.fat -F 32 -n boot /dev/sda1
@ -42,6 +63,19 @@ nixos-generate-config --root /mnt
nixos-install
```
remote (nvme):
```bash
mkfs.fat -F 32 -n boot /dev/nvme0n1p1
mkfs.btrfs -L nixos /dev/mapper/crypt
sleep 1
mount /dev/mapper/crypt /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
nixos-generate-config --root /mnt
nixos-install
```
local:
```bash
@ -54,17 +88,15 @@ remote:
```bash
mkdir -p /mnt/home/cyryl/dev/dotfiles/
tar -xvf /tmp/dotfiles.tar.gz -C /mnt/home/cyryl/dev/dotfiles
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/home/cyryl/dev/dotfiles/nixos/boxes/bootstrap/
ln -vfs /mnt/home/cyryl/dev/dotfiles/nixos/boxes/bootstrap/1.nix /mnt/etc/nixos/configuration.nix
nixos-install
cp /mnt/etc/nixos/hardware-configuration.nix /mnt/home/cyryl/dev/dotfiles/nixos/boxes/hostname/
nix-shell -p nixUnstable git
nixos-install --flake '.#hostname-bootstrap'
reboot
```
ctrl-alt-f1 root login:
```bash
ln -vfs /home/cyryl/dev/dotfiles/nixos/boxes/bootstrap/2.nix /etc/nixos/configuration.nix
vim /home/cyryl/dev/dotfiles/nixos/boxes/bootstrap/2.nix
nixos-rebuild switch
passwd cyryl
chown cyryl -R /home/cyryl

View file

@ -15,12 +15,6 @@
initrd = {
kernelModules = [ "dm-snapshot" ];
availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
luks.devices = {
root = {
device = "/dev/disk/by-uuid/a9e8a44f-15be-4844-a0a1-46892cc5e44e";
allowDiscards = true;
};
};
};
loader.grub = {
@ -31,12 +25,23 @@
loader.efi.canTouchEfiVariables = true;
};
fileSystems."/" = { device = "/dev/disk/by-uuid/7ae9348d-604e-4196-a27b-24a7495438c3"; fsType = "ext4"; };
fileSystems."/" =
{ device = "/dev/mapper/crypt";
fsType = "btrfs";
};
fileSystems."/boot" = { device = "/dev/disk/by-uuid/C4DD-2374"; fsType = "vfat"; };
boot.initrd.luks.devices."crypt".device = "/dev/disk/by-uuid/c2b23e5e-82c6-45dc-b07d-a8f9be03440e";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/C380-BA8A";
fsType = "vfat";
};
swapDevices = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.video.hidpi.enable = lib.mkDefault true;
zramSwap = {
enable = true;
algorithm = "zstd";