mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-09-13 02:30:04 +00:00
Compare commits
4 commits
6d46153097
...
ce9413777b
Author | SHA1 | Date | |
---|---|---|---|
ce9413777b | |||
ca5dd2a55a | |||
04c20800b0 | |||
fef6f312c2 |
4 changed files with 69 additions and 33 deletions
|
@ -9,6 +9,34 @@ be a useful resource for you too, if you want to achieve a similar setup.
|
||||||
This guide includes steps for full disk encryption, and sets up the system with
|
This guide includes steps for full disk encryption, and sets up the system with
|
||||||
some basic tools and my zsh configuration.
|
some basic tools and my zsh configuration.
|
||||||
|
|
||||||
|
## Internet
|
||||||
|
|
||||||
|
If you're using ethernet, you can skip this part, it focuses on Wi-Fi.
|
||||||
|
|
||||||
|
To connect to Wi-Fi from the installation ISO system, run `iwctl`. From there, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
device list
|
||||||
|
# Find the device you're interested in, usually something like wlan0
|
||||||
|
# Also take notice of the adapter name that this device uses
|
||||||
|
#
|
||||||
|
# Before anything else, make sure to power on the device and the adapter
|
||||||
|
device [device] set-property Powered on
|
||||||
|
adapter [adapter] set-property Powered on
|
||||||
|
# Now put the device into a scan mode and get the results
|
||||||
|
# You can skip this part if you know the SSID
|
||||||
|
station [device] scan
|
||||||
|
station [device] get-networks
|
||||||
|
# Find the SSID of the network you're interested
|
||||||
|
station [device] connect "[SSID]"
|
||||||
|
# You'll be prompted for a password, enter it, then you should get connected
|
||||||
|
# To leave iwd, press Ctrl+D
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, let's to sure it worked, run: `ping 1.1.1.1`.
|
||||||
|
|
||||||
|
To get DNS working too, you'll also want to run `dhcpcd`, then you can with `ping google.com`
|
||||||
|
|
||||||
## Partitioning
|
## Partitioning
|
||||||
|
|
||||||
First thing we will need to do is set up partitions. To do so, I recommend using
|
First thing we will need to do is set up partitions. To do so, I recommend using
|
||||||
|
@ -16,18 +44,22 @@ First thing we will need to do is set up partitions. To do so, I recommend using
|
||||||
partitions:
|
partitions:
|
||||||
|
|
||||||
- EFI (1 GB)
|
- EFI (1 GB)
|
||||||
- Swap (same size as your RAM, or more)
|
- Root, Data & Swap (rest)
|
||||||
- Data (rest)
|
|
||||||
|
|
||||||
The swap partition is optional, however I do recommend creating it (instead of
|
Some people like to use a swap partition, however, doing so on an otherwise encrypted
|
||||||
using a swap file), as it will allow you to hibernate your machine.
|
system introduces you to unnecessary risk factors, as your swap likely won't be encrypted.
|
||||||
|
This is especially problematic for hibernation, as hibernating into an unencrypted swap
|
||||||
|
partition will allow passwordless restore.
|
||||||
|
|
||||||
|
Instead, I prefer using a swapfile within BTRFS. This still allows hibernation with
|
||||||
|
systemd initrd, but only after unlocking the partition.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Don't forget to also set the type for these partitions (`t` command in `fdisk`).
|
> Don't forget to also set the type for these partitions (`t` command in `fdisk`).
|
||||||
>
|
>
|
||||||
> - EFI partition type: EFI System (1)
|
> - EFI partition type: EFI System (1)
|
||||||
> - Swap partition type: Linux swap (19)
|
> - Root partition type: Linux root x86-64 (23)
|
||||||
> - Data partition type: Linux filesystem (20)
|
> - (Extra) Data partition type: Linux filesystem (20)
|
||||||
|
|
||||||
### File-Systems
|
### File-Systems
|
||||||
|
|
||||||
|
@ -37,8 +69,6 @@ Now we'll to create file systems on these partitions, and give them disk labels:
|
||||||
mkfs.fat -F 32 /dev/sdX1
|
mkfs.fat -F 32 /dev/sdX1
|
||||||
fatlabel /dev/sdX1 EFI
|
fatlabel /dev/sdX1 EFI
|
||||||
|
|
||||||
mkswap -L SWAP /dev/diskX2
|
|
||||||
|
|
||||||
cryptsetup luksFormat /dev/sdX3 --label CRYPTFS
|
cryptsetup luksFormat /dev/sdX3 --label CRYPTFS
|
||||||
cryptsetup open /dev/disk/by-label/CRYPTFS crypfs
|
cryptsetup open /dev/disk/by-label/CRYPTFS crypfs
|
||||||
mkfs.btrfs -L FS /dev/mapper/cryptfs
|
mkfs.btrfs -L FS /dev/mapper/cryptfs
|
||||||
|
@ -62,12 +92,15 @@ Now we will split our btrfs partition into the following subvolumes:
|
||||||
and backed up.
|
and backed up.
|
||||||
- snapshots: A subvolume that will be used to store snapshots (backups) of the
|
- snapshots: A subvolume that will be used to store snapshots (backups) of the
|
||||||
other subvolumes
|
other subvolumes
|
||||||
|
- swap: A subvolume containing the swap file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mount /dev/mapper/cryptfs /mnt
|
mount /dev/mapper/cryptfs /mnt
|
||||||
btrfs subvolume create /mnt/root
|
btrfs subvolume create /mnt/root
|
||||||
btrfs subvolume create /mnt/data
|
btrfs subvolume create /mnt/data
|
||||||
btrfs subvolume create /mnt/snapshots
|
btrfs subvolume create /mnt/snapshots
|
||||||
|
btrfs subvolume create /mnt/swap
|
||||||
|
btrfs filesystem mkswapfile --size 16g --uuid clear /mnt/swap/swapfile
|
||||||
umount /mnt
|
umount /mnt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -76,30 +109,29 @@ umount /mnt
|
||||||
<!-- markdownlint-disable MD028 -->
|
<!-- markdownlint-disable MD028 -->
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Even though we're specifying the `compress` flag in the mount options of each
|
> The `compress` mount flag will only affect the newly created files, if you're adding
|
||||||
> btrfs subvolume, somewhat misleadingly, you can't actually use different
|
> this option later on, older files will still remain uncompressed/differently compressed
|
||||||
> compression levels for different subvolumes. Btrfs will share the same
|
> on the disk.
|
||||||
> compression level across the whole partition, so it's pointless to attempt to
|
|
||||||
> set different values here.
|
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> You may have seen others use btrfs options such as `ssd`, `discard=async` and
|
> You may have seen others use btrfs options such as `ssd`, `discard=async` and
|
||||||
> `space_cache=v2`. These are all default (with the `ssd` being auto-detected),
|
> `space_cache=v2`. These are all default on modern kernels (with the `ssd` being
|
||||||
> so specifying them is pointless now.
|
> auto-detected), so specifying them is pointless now.
|
||||||
|
|
||||||
<!-- markdownlint-enable MD028 -->
|
<!-- markdownlint-enable MD028 -->
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mount -o subvol=root,compress=zstd:3,noatime /dev/mapper/cryptfs /mnt
|
mount -o subvol=root,noatime,lazytime,commit=120,compress=zstd:1 /dev/mapper/cryptfs /mnt
|
||||||
mount --mkdir -o subvol=home,compress=zstd:3,noatime /dev/mapper/cryptfs /mnt/data
|
mount --mkdir -o subvol=snapshots,noatime,lazytime,commit=120,compress=zstd:1 /dev/mapper/cryptfs /mnt/snapshots
|
||||||
mount --mkdir -o subvol=snapshots,compress=zstd:3,noatime /dev/mapper/cryptfs /mnt/snapshots
|
mount --mkdir -o subvol=home,noatime,lazytime,commit=120,compress=zstd:5 /dev/mapper/cryptfs /mnt/data
|
||||||
mount --mkdir -o compress=zstd:3,noatime /dev/mapper/cryptfs /mnt/.btrfs
|
mount --mkdir -o noatime,lazytime,commit=120,compress=zstd:1 /dev/mapper/cryptfs /mnt/.btrfs
|
||||||
|
mount --mkdir -o subvol=swap /dev/mapper/cryptfs /mnt/swap
|
||||||
|
|
||||||
mount --mkdir /dev/disk/by-label/EFI /mnt/efi
|
mount --mkdir /dev/disk/by-label/EFI /mnt/efi
|
||||||
mkdir /mnt/efi/arch
|
mkdir /mnt/efi/arch
|
||||||
mount --mkdir --bind /mnt/efi/arch /mnt/boot
|
mount --mkdir --bind /mnt/efi/arch /mnt/boot
|
||||||
|
|
||||||
swapon /dev/disk/by-label/SWAP
|
swapon /mnt/swap/swapfile
|
||||||
```
|
```
|
||||||
|
|
||||||
## Base installation
|
## Base installation
|
||||||
|
@ -193,23 +225,24 @@ they're way too permissive. This is how I like to structure my fstab:
|
||||||
# /dev/nvme1n1p1 LABEL=EFI UUID=A34B-A020
|
# /dev/nvme1n1p1 LABEL=EFI UUID=A34B-A020
|
||||||
/dev/disk/by-label/EFI /efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
|
/dev/disk/by-label/EFI /efi vfat rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro 0 2
|
||||||
|
|
||||||
# /dev/nvme1n1p2 LABEL=SWAP UUID=d262a2e5-a1a3-42b1-ac83-18639f5e8f3d
|
|
||||||
/dev/disk/by-label/SWAP none swap defaults 0 0
|
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
# region: BTRFS Subvolumes
|
# region: BTRFS Subvolumes
|
||||||
|
|
||||||
# /dev/mapper/cryptfs LABEL=FS UUID=bffc7a62-0c7e-4aa9-b10e-fd68bac477e0
|
# /dev/mapper/cryptfs LABEL=FS UUID=bffc7a62-0c7e-4aa9-b10e-fd68bac477e0
|
||||||
/dev/mapper/cryptfs / btrfs rw,noatime,compress=zstd:1,subvol=/root 0 1
|
/dev/mapper/cryptfs / btrfs rw,noatime,lazytime,compress=zstd:1,ssd,space_cache=v2,commit=120,discard=async,subvol=/root 0 1
|
||||||
/dev/mapper/cryptfs /data btrfs rw,noatime,compress=zstd:1,subvol=/data 0 2
|
/dev/mapper/cryptfs /data btrfs rw,noatime,lazytime,compress=zstd:5,ssd,space_cache=v2,commit=120,discard=async,subvol=/data 0 2
|
||||||
/dev/mapper/cryptfs /snapshots btrfs rw,noatime,compress=zstd:1,subvol=/snapshots 0 2
|
/dev/mapper/cryptfs /snapshots btrfs rw,noatime,lazytime,compress=zstd:1,ssd,space_cache=v2,commit=120,discard=async,subvol=/snapshots 0 2
|
||||||
/dev/mapper/cryptfs /.btrfs btrfs rw,noatime,compress=zstd:1 0 2
|
/dev/mapper/cryptfs /swap btrfs rw,subvol=/swap 0 0
|
||||||
|
/dev/mapper/cryptfs /.btrfs btrfs rw,noatime,lazytime,compress=zstd:1,ssd,space_cache=v2,commit=120,discard=async 0 2
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
# region: Bind mounts
|
# region: Bind mounts
|
||||||
|
|
||||||
# Write kernel images to /efi/arch, not directly to efi system partition (esp), to avoid conflicts when dual booting
|
# Write kernel images to /efi/arch, not directly to efi system partition (esp), to avoid conflicts when dual booting
|
||||||
/efi/arch /boot none rw,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro,bind 0 0
|
/efi/arch /boot none rw,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro,bind 0 0
|
||||||
|
|
||||||
|
# Swap into a file on the btrfs partition
|
||||||
|
/swap/swapfile none swap defaults 0 0
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
```
|
```
|
||||||
|
@ -302,7 +335,7 @@ options rw loglevel=3
|
||||||
And finally configure loader - `/efi/loader/loader.conf` (overwrite the contents):
|
And finally configure loader - `/efi/loader/loader.conf` (overwrite the contents):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
default arch-hyprland.conf
|
default arch.conf
|
||||||
timeout 4
|
timeout 4
|
||||||
console-mode auto
|
console-mode auto
|
||||||
editor yes
|
editor yes
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
[tool.black]
|
|
||||||
line-length=119
|
|
|
@ -53,11 +53,13 @@ export XDG_PICTURES_DIR="$HOME/Media/Pictures"
|
||||||
export XDG_VIDEOS_DIR="$HOME/Media/Videos"
|
export XDG_VIDEOS_DIR="$HOME/Media/Videos"
|
||||||
export XDG_SCREENSHOTS_DIR="$HOME/Media/Pictures/Screenshots"
|
export XDG_SCREENSHOTS_DIR="$HOME/Media/Pictures/Screenshots"
|
||||||
|
|
||||||
# Per-Application XDG settings
|
# ZSH dirs
|
||||||
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
|
||||||
export ZSH_CACHE="$HOME/.cache/zsh"
|
export ZSH_CACHE="$HOME/.cache/zsh"
|
||||||
export HISTFILE="$ZSH_CACHE/history"
|
export HISTFILE="$ZSH_CACHE/history"
|
||||||
export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION"
|
export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-${ZSH_VERSION:-}"
|
||||||
|
|
||||||
|
# Per-Application XDG settings
|
||||||
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
|
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
|
||||||
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
|
#export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
|
||||||
export LESSHISTFILE="-"
|
export LESSHISTFILE="-"
|
||||||
|
|
|
@ -20,3 +20,6 @@
|
||||||
- /swapfile
|
- /swapfile
|
||||||
- /swap/*
|
- /swap/*
|
||||||
- /home/*/.cache/*
|
- /home/*/.cache/*
|
||||||
|
- /.btrfs/*
|
||||||
|
- /snapshots/*
|
||||||
|
- /data/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue