⠀⠀ 🌸 Setup / Hyprland 🌸
-----------------------------------
╭─ Distro -> NixOS
├─ Editor -> Neovim
├─ Browser -> Zen
├─ Shell -> Zsh
╰─ Resource Monitor -> Btop
╭─ Model -> DELL XPS 8940
├─ CPU -> Intel i5-10400f @ 4.3GHz
├─ GPU -> NVIDIA GeForce GTX 1650 SUPER
╰─ Resolution -> 1920x1080@165hz
╭─ WM -> Hyprland
├─ Terminal -> Ghostty
├─ Theme -> Tokyonight
├─ Icons -> Papirus-Dark
├─ Font -> TX-02
╰─ Hotel -> Trivago
- Validate the flake:
nix flake check- Build the safe example system without switching your machine:
nix build '.#nixosConfigurations.example.config.system.build.toplevel'- Build the safe example Home Manager activation package:
nix build '.#homeConfigurations.example.activationPackage'- Rebuild and switch to change the system configuration (in the configuration directory):
nh os switch
OR
sudo nixos-rebuild switch --flake '.#desktop'
- Connect to internet (Change what's inside the brackets with your info).
nmcli device wifi connect [SSID] password [passphrase]
This repo uses sops-nix for encrypted secrets, including the desktop user password. See docs/sops-setup.md for the step-by-step guide.
flake.nixdiscovers NixOS hosts fromhosts/*and Home Manager users fromhome/users/*.nix.hosts/<name>/configuration.nixcontains host-specific system settings.profiles/contains shared defaults imported by hosts.profiles/nixos/minimal.nixandprofiles/home/minimal.nixprovide safer public defaults for examples.modules/contains reusable NixOS modules exposed undermyConfig.home/contains reusable Home Manager modules exposed undermyHomeConfig.hosts/exampleandhome/users/example.nixare the recommended starting points for users testing this repo.ci/font-flake-fallbackprovides a public font fallback for unauthenticated builds.lib/contains helper functions used to create hosts and home configurations.
The public default uses a local fallback flake that exposes tx02 as JetBrains Mono. To use the private font flake locally, override the input:
nh os switch -- --override-input font-flake github:redyf/font-flake
nh home switch -- --override-input font-flake github:redyf/font-flakeCaution
desktop and selene are my personal machines. Do not install them directly
on your hardware unless you have reviewed every host-specific setting,
generated your own hardware config, and understand the disk layout.
Deploying someone else's NixOS host can make a machine unbootable or destroy data.
If you want to test this repository, start with the safe example outputs:
nix build '.#nixosConfigurations.example.config.system.build.toplevel'
nix build '.#homeConfigurations.example.activationPackage'The example host uses username example and initial password nixos. Treat it as
a learning target, not a final install profile.
I'll guide you through the Installation, but first make sure to download the Minimal ISO image available at NixOS and make a bootable drive with it. I suggest using Rufus for the task as it's a great software, and an ethernet cable to make things easier. We shall begin!
Installation Steps
Only follow these steps after using the bootable drive, changing BIOS boot priority and getting into the installation!
First part:
video=1920x1080
setfont ter-128n
configure networking as needed (skip this if you're using ethernet)
sudo -i
lsblk (check info about partitions and the device you want to use for the installation)
gdisk /dev/vda (change according to your system, for me it's /dev/nvme0n1)
then configure 600M type ef00, rest ext4 type 8300 as described below
Type "n" to make a new partition, choose the partition number, first sector can be default but last sector should be 600M. Hex code for EFI is ef00.
Now type n again to make another partition, this time we'll leave everything as default. After finishing these steps, make sure to write it to the disk by typing "w".
lsblk
mkfs.fat -F 32 -n boot /dev/vda1 (Format the partitions)
mkfs.ext4 -L nixos /dev/vda2
mount /dev/disk/by-label/nixos /mnt (Mount partitions)
mkdir /mnt/boot (Create a directory for boot)
mount /dev/disk/by-label/boot /mnt/boot
After mounting the partitions, you can move to the second part...
# go inside a nix shell with the specified programs
nix-shell -p git nixUnstable neovim
# create this folder if necessary
mkdir -p /mnt/etc/
# clone the repo
git clone https://github.com/redyf/nixdots.git /mnt/etc/nixos --recurse-submodules
# remove this file
rm /mnt/etc/nixos/hosts/desktop/hardware-configuration.nix
# generate the config and take some files
nixos-generate-config --root /mnt
rm /mnt/etc/nixos/configuration.nix
mv /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/hosts/desktop/
# make sure you're in this path
cd /mnt/etc/nixos
# Install my personal desktop config only after adapting hardware and secrets:
nixos-install --flake '.#desktop'
# Obs:
If you'd like to use my config as a template, copy `hosts/example` and `home/users/example.nix`, then update the matching metadata in `hosts/<name>/meta.nix`.
Disko is also available for formatting partitions (Only for advanced users)
Disko
Disko commands are destructive. Always pass the target disk explicitly and verify it with lsblk first.
If you save disko's config file in ./disks/default.nix, and run the following command:
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./disks/default.nix --arg device '/dev/nvme0n1'you will partition, format and mount the disk for /dev/nvme0n1 (change as needed).
- rpi-imager
- sd-card
- Raspberry-PI5
- Another device to connect remotely (PC, Laptop, etc)
- Ethernet connection
-
Open rpi-imager and select your device, then Raspberry Pi OS and sd-card.
-
Customize settings to your needs, like defining a user/hostname and enabling ssh.
-
Insert the sd-card in your Raspberry PI5 and boot.
-
Install Nix on it by running the following command:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install- Install Cachix client by running:
nix-env -iA cachix -f https://cachix.org/api/v1/install- Start using the binary cache by running:
cachix use nix-community- Clone the following repo:
https://github.com/nix-community/raspberry-pi-nix.git-
Customize
flake.nixto match your needs, like changing hostname, timezones, etc. -
Build an image suitable for flashing to an sd-card by running:
nix build '.#nixosConfigurations.rpi-example.config.system.build.sdImage'
- Connect to your main machine with ssh and copy the image to it using scp. You can use the following commands:
scp /path/to/file username@a:/path/to/destination
or
scp username@b:/path/to/file /path/to/destination
- Decompress the image with zstd, this is going to generate a .img file.
sudo zstd -d result/sd-image/nixos-sd-image-24.05.20240619.dd457de-aarch64-linux.img.zst- Copy the image to your sd-card:
sudo dd bs=4M if=result/sd-image/nixos-sd-image-24.05.20240619.dd457de-aarch64-linux.img of=/dev/mmcblk0 conv=fsync oflag=direct status=progress- Boot the Raspberry-PI5 with the sd-card and you should be good to go
All references are written below. I wouldn't be able to install it without them! I really appreciate their hard work, make sure to give them a star.
- Raspberry PI 5 support
- NixOS on ARM/Raspberry Pi 5
- Pi 5 support
- raspberry-pi-nix
- raspberry-pi-nix binary cache
- nix-rpi5
- raspberrypi/firmware
- AlphaTechnolog
- Eriim's
- IogaMaster
- linuxmobile
- NotAShelf
- notusknot
- Siduck76
- Sioodmy
- Stephenstechtalks
- ZerotoNix
- NobbZ
That should be all! If you have any problem, feel free to make an issue in the github repo. (https://github.com/Redyf/nixdots/issues).
The code is licensed under the MIT license, so you can use or distribute the code however you like. If you have any questions, contact me on Discord: redyf.