dotfiles/README.md

123 lines
2.4 KiB
Markdown
Raw Permalink Normal View History

2024-06-02 16:57:11 +02:00
# Dotfiles
## NixOS
2024-10-29 14:44:50 +01:00
Install instructions for NixOS.
First open a shell with vim and git:
2024-06-02 16:57:11 +02:00
```bash
2024-10-29 14:44:50 +01:00
nix-shell -p git vim
```
### EXT4
2024-06-02 16:57:11 +02:00
2024-10-29 14:44:50 +01:00
```bash
parted /dev/nvme0n1 -- mklabel gpt
parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB
parted /dev/nvme0n1 -- mkpart root ext4 512MB 100%
parted /dev/nvme0n1 -- set 1 esp on
2024-06-02 16:57:11 +02:00
2024-10-29 14:44:50 +01:00
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
mkfs.ext4 -L NixOS /dev/nvme0n1p2
2024-06-02 16:57:11 +02:00
2024-10-29 14:44:50 +01:00
mount /dev/disk/by-label/NixOS /mnt
mkdir -p /mnt/boot
mount -o umask=077 /dev/disk/by-label/BOOT /mnt/boot
nixos-generate-config --root /mnt
```
### ZFS
First stop the zfs-zed service, and unload the ZFS kernel modules:
```bash
systemctl stop zfs-zed
lsmod | grep zfs | cut -d' ' -f1 | xargs rmmod -f
```
Then add the following to `/etc/nixos/configuration.nix`:
```bash
boot.supportedFilesystems = [ "zfs" ];
```
And rebuild the system:
```bash
nixos-rebuild switch --upgrade
```
Partition the disk:
```bash
parted --script /dev/nvme0n1 -- mklabel gpt mkpart esp fat32 1MiB 512MiB mkpart primary 512MiB 100% set 1 boot on
```
Create an encrypted pool:
```bash
zpool create -f -o ashift=12 -O encryption=on -O keyformat=passphrase -O mountpoint=none rpool /dev/nvme0n1p2
```
Create a root partition:
```bash
zfs create -o mountpoint=legacy rpool/root
mkdir -p /mnt
mount -t zfs rpool/root /mnt
```
And home partition:
```bash
zfs create -o mountpoint=legacy -o compression=on rpool/home
mkdir -p /mnt/home
mount -t zfs rpool/home /mnt/home
```
Format the boot partition:
```bash
mkfs.fat -F 32 -n BOOT /dev/nvme0n1p1
mkdir -p /mnt/boot
mount -t vfat /dev/nvme0n1p1 /mnt/boot
```
Generate the configuration:
```bash
nixos-generate-config --root /mnt
2024-06-06 20:26:15 +02:00
```
2024-10-29 14:44:50 +01:00
Add the following to /mnt/etc/nixos/configuration.nix:
```bash
boot.initrd.supportedFilesystems = [ "zfs" ];
boot.supportedFilesystems = [ "zfs" ];
services.zfs.autoScrub.enable = true;
networking.hostName = "Aloria";
networking.hostId = "abcdef01";
```
### Install
2024-06-06 20:26:15 +02:00
Then either clone the repository:
```
2024-06-02 16:57:11 +02:00
git clone https://git.thomasave.be/thomasave/Dotfiles
2024-10-29 14:44:50 +01:00
sudo nixos-install --impure --flake ./Dotfiles#Aloria
2024-06-02 17:08:38 +02:00
mv ./Dotfiles /mnt/home/user/.dotfiles
sudo ln -s /home/user/.dotfiles /mnt/etc/nixos
2024-06-06 20:26:15 +02:00
```
Or install it directly:
2024-06-02 17:08:38 +02:00
2024-06-06 20:26:15 +02:00
```
2024-10-29 14:44:50 +01:00
sudo nixos-install --impure --flake git+https://git.thomasave.be/thomasave/Dotfiles#Aloria
```
### Post-install
Clean-up:
```bash
umount /mnt/{home,boot}
umount /mnt
```
If using ZFS:
```bash
zpool export -a
2024-06-02 16:57:11 +02:00
```