# NixOS configuration with Hyprland


This repository contains the declarative configuration files for my Thinkpad T480, it uses NixOS and Hyprland as the window compositor, it should work on most hardware just fine, assuming you are using an Intel IGPU, adjust accordingly to the NixOS wiki if needed.

> It works on my hardware, and of course it is not guaranteed to fully work on yours, although it should.



![screenshot](/assets/preview.jpg)



---


## Preparation


In order to use these configuration files you do need to use NixOS unstable, ideally download the unstable ISO instead of the stable one, and install the system that way to avoid unnecessary steps, you can download it from [here](https://releases.nixos.org/nixos/unstable/nixos-26.05pre980183.4bd9165a9165) and burn it onto your USB drive accordingly to their wiki page, after that you can boot from the USB. It works on stable tho as long as you comment the dunst section in ```desktop/home/default.nix```.


## Installation


This setup assumes that you are going to use full disk encryption and label the boot partition as "BOOT", and the root partition as "ROOT", here is a list of steps in order to do so:


Check your drive identificator and create a 512MB boot partition, and a root partition of any size, can be the rest of your disk.



```bash
sudo lsblk
fdisk /dev/sdX
```


After partitioning the drive and assuming /dev/sdX1 is the boot partition and /dev/sdX2 is the root one, do the following to achieve full disk encryption and format the drives with correct labels:


```bash
sudo mkfs.fat -F 32 /dev/sdX1
sudo fatlabel /dev/sdX1 BOOT
sudo cryptsetup luksFormat -y --label="ROOT" /dev/sdX2
sudo cryptsetup luksOpen /dev/sdX2 ROOT
sudo mkfs.xfs -L "ROOT" /dev/mapper/ROOT
```


Afterwards you can mount the drives:


```bash
sudo mount /dev/disk/by-label/ROOT /mnt
sudo mkdir -p /mnt/boot
sudo mount /dev/disk/by-label/BOOT /mnt/boot
```


After mounting the drives, generate default directories for NixOS, cleanse of the old unnecessary files, enter a Nix shell in order to use the git package, and clone this repo:


```bash
sudo mkdir -p /mnt/etc/nixos
sudo nix-shell -p git
cd /mnt/etc/nixos/
git clone https://git.cln.cat/cln6/nixos-thinkpad
sudo mv nixos-thinkpad/* ./ && sudo rm -rf nixos-thinkpad
```


After that you can leave the Nix shell and enter into the proper directory, and install the system:


```bash
exit
cd /mnt
sudo nixos-install --flake /mnt/etc/nixos#cln (replace cln with your new hostname if you have decided to change it, instructions on how to do that are in the Notes section of this repo)
```


That's it, after it's done installing you should be able to reboot into the system, the default username is "cln" and password is "123", please change it after installation with the ```passwd cln``` command.



# Keybinds


---


## Applications

  | Keybind | App |
  |---|---|
  | Super + D | App launcher |
  | Super + Enter | kitty |
  | Super + Q | kitty |
  | Super + Shift + D | Mullvad browser |
  | Super + Shift + F | Librewolf |
  | Super + E | File manager |
  | Super + H | Clipboard history |
  | Super + B | Overskride ( Bluetooth ) |
  | Super + P | Pwvucontrol ( Audio ) |
  | Super + Shift + P | Power menu |


---


## Window Management


  | Keybind | Action |
  |---|---|
  | Super + Shift + Q | Kill active window |
  | Super + V | Toggle floating mode |
  | Super + J | Toggle split |
  | Super + O | Toggle dwindle |


---


## Workspace related


  | Keybind | Action |
  |---|---|
  | Super + 1-10 | Switch workspace to your chosen number |
  | Super + Shift + 1-10 | Move the active window to your chosen workspace |
  | Super + S | Switch to special workspace |
  | Super + Shift + S | Move the active window to the special workspace |


---


## Other


  | Keybind | Action |
  |---|---|
  | Super + Arrow key | Switch your current focused window |
  | Super + M | Exit hyprland |
  | Super + F1 | Toggle game mode |


---



# Notes
- In order to use a different username, replace every "cln" word with your desired username in these files: ```configuration.nix```, ```home.nix``` as well as "users.cln" line in ```flake.nix```.
- In order to change your hostname, edit the hostname line in ```networks/default.nix```, as well as all other lines with the word "cln" except for the "users.cln" line.


# Summary
So yeah these are my configuration files, I am aware that they are nowhere near perfect, I am a really unprofessional and new NixOS user as for now, but it is what it is for now, my next distro will probably be Gentoo if everything goes right, therefore this will stay as it is for now I think.
