Skip to content

redyf/nixdots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❄️ NixOS dotfiles ❄️

NixOS system configuration. Feel free to explore!

⠀⠀   🌸 Setup / Hyprland 🌸
 -----------------------------------
 ╭─ Distro  -> NixOS
 ├─ Editor  -> Neovim
 ├─ Browser -> Firefox
 ├─ 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 -> Kitty
 ├─ Theme    -> Oxocarbon
 ├─ Icons    -> Papirus-Dark
 ├─ Font     -> SFMono Ligaturized
 ╰─ Hotel    -> Trivago
                        

rice showcase rice showcase2


Commands you should know:

  • Rebuild and switch to change the system configuration (in the configuration directory):
nh os switch

OR

sudo nixos-rebuild switch --flake '.#redyf'
  • Connect to internet (Change what's inside the brackets with your info).
nmcli device wifi connect [SSID] password [passphrase]

Installation

Caution

This hosts system and home configurations are public for your own learning and research. They are not meant to be used with any hardware other than mine. Trying to build and deploy them to other systems without appropriate changes can render your machines unbootable and damage data.

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/redyf/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/redyf/
# make sure you're in this path
cd /mnt/etc/nixos
# Install my config:
nixos-install --flake '.#redyf'
# Obs:
If you'd like to use my config as a template, all you need to do is replace "redyf" with your username.

Disko is also available for formatting partitions (Only for advanced users)

Disko

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).


NixOS Raspberry PI5 Installation

Requirements

  • rpi-imager
  • sd-card
  • Raspberry-PI5
  • Another device to connect remotely (PC, Laptop, etc)
  • Ethernet connection

Installation Steps

  1. Open rpi-imager and select your device, then Raspberry Pi OS and sd-card.

  2. Customize settings to your needs, like defining a user/hostname and enabling ssh.

  3. Insert the sd-card in your Raspberry PI5 and boot.

  4. Install Nix on it by running the following command:

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
  1. Install Cachix client by running:
nix-env -iA cachix -f https://cachix.org/api/v1/install
  1. Start using the binary cache by running:
cachix use nix-community
  1. Clone the following repo:
https://github.com/nix-community/raspberry-pi-nix.git
  1. Customize flake.nix to match your needs, like changing hostname, timezones, etc.

  2. Build an image suitable for flashing to an sd-card by running:

nix build '.#nixosConfigurations.rpi-example.config.system.build.sdImage'
  1. 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
  1. 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
  1. 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
  1. 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.


All references/credits for the NixOS Raspberry-PI 5 setup:

Shoutout to:


Conclusion

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.