⠀⠀ 🌸 Setup / Hyprland 🌸
-----------------------------------
╭─ Distro -> NixOS
├─ Editor -> Neovim
├─ Browser -> Brave
├─ Shell -> Zsh
╰─ Resource Monitor -> Btop
╭─ Model -> DELL XPS 8940
├─ CPU -> Intel i5-10400f @ 4.3GHz
├─ GPU -> NVIDIA GeForce GTX 1650 SUPER
╰─ Resolution -> 1920x1080@180hz
╭─ WM -> Hyprland
├─ Terminal -> Ghostty
├─ Theme -> Catppuccin Macchiato
├─ Icons -> WhiteSur
├─ Font -> MonoLisa
╰─ 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@example".activationPackage'- Rebuild and switch to change the system configuration (in the configuration directory):
nh os switch
OR
sudo nixos-rebuild switch --flake '.#desktop'
- Rebuild and switch the Home Manager configuration (picks
$USER@$HOSTNAME):
nh home switch
- Format the tree (treefmt: nixfmt + statix):
nix fmt- 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 user password on both personal hosts (desktop and selene). See docs/sops-setup.md for the step-by-step guide.
flake.nixdiscovers NixOS hosts fromhosts/*and builds one Home Manager configuration per host, named<username>@<hostname>(e.g.selene@selene).nh home switchpicks it automatically.hosts/<name>/meta.nixholds the host metadata:username,system,rolesand optionallykeyboard.hosts/<name>/configuration.nixcontains host-specific system settings.profiles/nixos/holds roles (common,workstation,gaming,dev,laptop,nvidia,minimal).lib/mkHost.niximports the ones a host lists inmeta.nix.profiles/home/common.nixis the Home Manager baseline for the personal users;profiles/home/minimal.nixprovides safer public defaults. User files import one of them.modules/contains reusable NixOS modules exposed undermyConfig. Every.nixfile there is imported automatically and declares its ownmyConfig.<dir>.<name>.enable.home/contains reusable Home Manager modules exposed undermyHomeConfig. Every directory with adefault.nixis imported automatically and declares its ownmyHomeConfig.<path>.enable.users/<name>.nixholds per-user Home Manager settings;hosts/<name>/home.nix(optional) holds per-machine ones such as monitor layouts.hosts/exampleandusers/example.nixare the recommended starting points for users testing this repo.theme.nixholds the appearance (scheme, cursor, monospace font) shared by Stylix on both layers.ci/font-flake-fallbackprovides a public font fallback for unauthenticated builds.pkgs/<name>/package.nixholds custom packages, exposed aspkgs.<name>in every configuration and as the flake'spackages/overlays.default.lib/contains helper functions used to create hosts and home configurations.
Flakes only see files tracked by git, so git add new files before building.
Create modules/<dir>/<name>.nix. It is imported automatically; nothing else needs editing.
{ config, lib, ... }:
let
cfg = config.myConfig.<dir>.<name>;
in
{
options.myConfig.<dir>.<name>.enable = lib.mkEnableOption "<what it does>";
config = lib.mkIf cfg.enable {
# ...
};
}Turn it on from a role in profiles/nixos/<role>.nix with lib.mkDefault true, or from a host's configuration.nix with a plain true.
Create home/<group>/<name>/default.nix with the same shape, using myHomeConfig.<group>.<name>.enable. A directory with a default.nix is one module, so helper files can live next to it. Enable it in profiles/home/common.nix (shared) or users/<user>.nix (one user).
Create pkgs/<name>/package.nix (a callPackage-style function) and git add it. It is available as pkgs.<name> in NixOS and Home Manager modules, and builds with nix build .#<name>.
- Create
hosts/<name>/with:meta.nix:username,system,rolesand optionallykeyboard = { layout; variant; }.configuration.nix: imports the generatedhardware-configuration.nixand holds only host-specific choices.- optional
disko.nix,secrets.yaml(plus a rule in.sops.yaml) andhome.nix(per-machine Home Manager settings such as monitor layouts).
- If
usernameis new, addusers/<username>.nix(see below). Without it the host still gets a NixOS configuration, but no Home Manager one. - Build it with
nh os switch .(orsudo nixos-rebuild switch --flake '.#<name>') andnh home switch ..
hosts/example is the smallest working reference.
Create users/<name>.nix that imports profiles/home/common.nix (full setup) or profiles/home/minimal.nix (no GUI) and sets only what differs. Point a host at it with username in that host's meta.nix.
Home Manager runs standalone, so it cannot see the NixOS configuration, and nothing checks that the two agree. Keep these pairs in sync:
profiles/home/common.nixenableshyprland,serpantinum,stylix-themeandgtk-theme. They assume the host has theworkstationrole (NixOS Hyprland,programs.serpantinumandmyConfig.themes.stylix).cli.tools.tmuxreads colours from Stylix, so it needsdesktop.stylix-themeenabled.cli.tools.git.sopsIdentityneedsmyConfig.system.sops.gitIdentity.enableon the host.- The Hyprland monitor names in
hosts/<name>/home.nixmust match the outputs of that machine.
If many features start to need NixOS and Home Manager changes together, the dendritic pattern (one file per feature that defines both sides, built on flake-parts) would be worth revisiting. For a few hosts the current split is simpler to read.
The public default uses a local fallback flake that exposes every private font (tx02, monolisa, berkeley-mono, sf-mono) 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.
Both hosts also take the user password from hosts/<name>/secrets.yaml, which
only my age keys can decrypt. Without your own secrets file the user has no password.
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@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 neovim
# create this folder if necessary
mkdir -p /mnt/etc/
# clone the repo
git clone https://github.com/redyf/nixdots.git /mnt/etc/nixos
# 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 `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 run disko against hosts/<host>/disko.nix, the command looks like this:
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko ./hosts/desktop/disko.nix --arg device '"/dev/nvme0n1"'you will partition, format and mount the disk for /dev/nvme0n1 (change as needed).
- 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.