+++
title = "Prelude"
description = "My NixOS Configuration"
date = 2025-12-17
[taxonomies]
series = ["NixOS Desktop"]
tags = ["Linux", "NixOS"]
[extra]
ToC = true
edit = true
comments = true
+++
I don't know Linux
Go away.
If you’re looking for a beginner’s guide, this is not it. This is a postmortem of a bad idea that worked.
I sadly do not possess much time, and quite frankly, most of the rest of this page/series will go over your head.
However, if your tastes are sufficiently messed up - or if you enjoy watching someone over-engineer their computer to the point of absurdity - this might hopefully be a fun read.
My entire life has been a contradiction of sorts, notwithstanding the OS I currently use.
I chose arguably the most difficult distro to learn to use specifically so I would never have to learn how to fix it again.
What is this "NixOS" thing?
If you've ever used Linux before (like Ubuntu or Arch), you know the drill: you install the OS, you run a bunch of terminal commands to install software, you edit a text file here and there, and eventually, you have a system that feels like home.
But you also know the fear.
The fear that if you delete the wrong file, mess with the wrong package, or even upgrade to a new release, your computer might implode, and you'll have no idea how to get back to the way things were.
That's it I'm _\_ switching back to Windows forever
--> Me (right after the 69420th distro-hop that caused my system to crash and burn)
NixOS is different.
Basically, you define a blueprint - a single configuration file that describes exactly how you want your computer to function.
You want Firefox? You write firefox in the file. You wanna set your wallpaper? Just chuck it into the file.
After you're done, Nix reads it, and builds your entire operating system to match exactly what you wrote.
If you mess up, you just undo the text in the file, and your computer goes back to being perfect.
And oh, lest I forget to mention, you’d never have to deal with the godforsaken dependency hell [^1].
And now for the theatrics...
The Descent into Madness
It started innocently enough. I just wanted a system that was reproducible.
I began with Nix Flakes, the "Gateway Drug" [^2] of the ecosystem.
Instead of vaguely gesturing at a repository and hoping for the best, flake.nix declares every input my system depends on, and flake.lock pins each one to an exact revision.
It is the ultimate insurance policy: if I build this system today, or in about 10 years in the midst of an imminent meteor strike, I will get the exact same system [^4].
But having a reproducible system wasn't enough. It had to be obedient.
I pulled in Home Manager because configuring the OS wasn't enough; I needed to micromanage my user config files too.
Then came Stylix. I declare a single image and a color scheme, and Stylix enforces this theme across everything. It generates CSS for Waybar, restyles all my apps, and even bullies my terminal into submission.
But why stop there? I grabbed Spicetify to force Spotify to match my aesthetic, and Nixcord for Discord cuz why the heck not.
"Okay, it's pretty," you say. "But is it useful?"
You have no idea [^4].
I don't "install" development tools. I have a directory that defines isolated environments for C++, Python, JavaScript and so on.
When I cd into a project, Direnv and Lorri kick in, and the compiler, linter, LSP and whatnot along with all of their configuration just appear in my shell. When I leave, they vanish.
Every little thing is specified in code, from backups to network settings and even complex editor workflows (thanks for your concern, but I very likey my trusty VS Code).
Heck, even my Printer configuration is defined in a Nix file.
Well what else do ya need?
I still wanted to play games and run Android apps. A normal person would dual-boot or use an emulator.
I run Waydroid to run Android in a container.
Then, for the pièce de résistance, I set up VFIO GPU Passthrough [^3]. I pass that GPU directly into a Windows VM and use Looking Glass to stream the video output back to my PC screen with negligible latency.
I've also declaratively configured Minecraft Servers (cuz that 2 week period happens every other month for me, don't judge).
At this point most people would stop
Well I didn't.
I needed to know that my system was spiritually pure. So I formatted my drive with ZFS (its own merits aside) and implemented Impermanence.
Every time I reboot, my root dataset rolls back to an empty snapshot. Wiped. Gone. My OS comes back from a blank slate every boot, preserving only what I explicitly whitelist on a separate dataset.
To manage secrets without em dying in the purge, I use sops-nix to encrypt passwords and API keys using GPG, directly into my publicly hosted git repo, without leaking any sensitive data.
The result of all this?
If I buy a new computer today, I don't spend a week installing drivers and recovering my workflow.
I clone my repository. I run one single command.
And I doomscroll. Soon as I return [^4], I spin up an AAA Windows game, displayed on a tiling Linux WM (heck, even choose between Hyprland and Niri), on a system that deletes and rebuilds itself on every boot.
God, I love NixOS, and I hate it cuz now I can't go back to anything else.
A Fair Warning
Before you rush off to install this magical operating system, we need to have a serious chat.
NixOS is hard.
And I don't mean "Linux is hard" kind of hard. Its more "I have to relearn how everything works" kind of hard.
- It is not standard Linux: Most tutorials you find on the internet simply will not work here. You can't just
apt install your problems away.
- The Documentation is... sparse: Sometimes you will be reading a manual, and sometimes you will be reading 10-year-old Reddit threads praying for an answer.
- Patience is key (or severe OCD tbh): If you are not acquainted with the command line, programming languages, random crash logs, or want a computer that "just works" to play games or browse the web, consider yourself warned. Cuz this setup costs time, sanity, and a concerning amount of self-restraint.
Still Reading?
If you really want to get dirty with Nix and decide to invest oodles of your time into building your own configuration, my repository can be used as inspiration.
You can check out the list of links below to resourceful Nix documentation/tutorials/projects that may be helpful in your endeavour, as they were in mine.
Links
See: A Curated List of the best resources in the Nix Community
Also: This website for beginners starting out with NixOS and Flakes
Other Sources
- Tweag Article introducing Flakes
- Serokell's Blog on Flakes
- Jordan Isaac's Blog for porting configuration to Flakes
- Jon Ringer's Videos on general NixOS Tooling and Hackery
- Justin's Notes on using Nix
- Lan Tian's Series of Blog Posts on NixOS
- Christine's Blog Posts addressing NixOS Security
- Graham's and Elis' Blog Posts on Ephemeral Partition Schemes
Other Configurations
Here are some repositories that I may have shamelessly rummaged through for building my dotfiles:
Thanks a lot! ;)
[^1]: Wiki for life
[^2]: Meaning ig
[^3]: Arch Wiki my love
[^4]: T&C Apply ;)
1+++
2title = "Prelude"
3description = "My NixOS Configuration"
4date = 2025-12-17
5
6[taxonomies]
7series = ["NixOS Desktop"]
8tags = ["Linux", "NixOS"]
9
10[extra]
11ToC = true
12edit = true
13comments = true
14+++
15
16# I don't know Linux
17
18Go away.
19If you’re looking for a beginner’s guide, this is not it. This is a postmortem of a bad idea that worked.
20
21I sadly do not possess much time, and quite frankly, most of the rest of this page/series will go over your head.
22However, if your tastes are sufficiently messed up - or if you enjoy watching someone over-engineer their computer to the point of absurdity - this might hopefully be a fun read.
23
24My entire life has been a contradiction of sorts, notwithstanding the OS I currently use.
25I chose arguably the most difficult distro to learn to use specifically so I would never have to learn how to fix it again.
26
27# What is this "NixOS" thing?
28
29If you've ever used Linux before (like Ubuntu or Arch), you know the drill: you install the OS, you run a bunch of terminal commands to install software, you edit a text file here and there, and eventually, you have a system that feels like home.
30
31But you also know the **fear**.
32
33The fear that if you delete the wrong file, mess with the wrong package, or even upgrade to a new release, your computer might implode, and you'll have no idea how to get back to the way things were.
34
35> That's it I'm _\<redacted\>_ switching back to Windows forever
36> --> **Me** ~~(right after the 69420th distro-hop that caused my system to crash and burn)~~
37
38**NixOS is different.**
39
40Basically, you define a **blueprint** - a single configuration file that describes exactly how you want your computer to function.
41You want Firefox? You write `firefox` in the file. You wanna set your wallpaper? Just chuck it into the file.
42
43After you're done, [Nix](https://github.com/NixOS/nix) reads it, and builds your entire operating system to match exactly what you wrote.
44If you mess up, you just undo the text in the file, and your computer goes back to being perfect.
45And oh, lest I forget to mention, you’d never have to deal with the godforsaken dependency hell [^1].
46
47---
48
49_And now for the theatrics..._
50
51# The Descent into Madness
52
53It started innocently enough. I just wanted a system that was **reproducible**.
54
55I began with **Nix Flakes**, the "Gateway Drug" [^2] of the ecosystem.
56Instead of vaguely gesturing at a repository and hoping for the best, `flake.nix` declares every input my system depends on, and `flake.lock` pins each one to an exact revision.
57It is the ultimate insurance policy: if I build this system today, or in about 10 years in the midst of an imminent meteor strike, I will get the exact same system [^4].
58
59But having a reproducible system wasn't enough. It had to be **obedient**.
60
61I pulled in [**Home Manager**](https://github.com/nix-community/home-manager) because configuring the OS wasn't enough; I needed to micromanage my user config files too.
62Then came [**Stylix**](https://github.com/nix-community/stylix). I declare a single image and a color scheme, and Stylix enforces this theme across everything. It generates CSS for [Waybar](https://github.com/Alexays/Waybar), restyles all my apps, and even bullies my terminal into submission.
63But why stop there? I grabbed [**Spicetify**](https://github.com/Gerg-L/spicetify-nix) to force Spotify to match my aesthetic, and [**Nixcord**](https://github.com/FlameFlag/nixcord) for Discord cuz why the heck not.
64
65**"Okay, it's pretty," you say. "But is it useful?"**
66
67You have no idea [^4].
68
69I don't "install" development tools. I have a [directory](https://github.com/maydayv7/dotfiles/tree/stable/shells) that defines isolated environments for C++, Python, JavaScript and so on.
70When I `cd` into a project, [Direnv](https://direnv.net/) and [**Lorri**](https://github.com/nix-community/lorri) kick in, and the compiler, linter, LSP and whatnot along with all of their configuration just _appear_ in my shell. When I leave, they vanish.
71
72Every little thing is specified in code, from backups to network settings and even complex editor workflows (thanks for your concern, but I very likey my trusty [VS Code](https://code.visualstudio.com/)).
73Heck, even my **_Printer_** configuration is defined in a Nix file.
74
75**Well what else do ya need?**
76
77I still wanted to play games and run Android apps. A normal person would dual-boot or use an emulator.
78
79I run [Waydroid](https://github.com/waydroid/waydroid) to run Android in a container.
80Then, for the _pièce de résistance_, I set up [VFIO](https://docs.kernel.org/driver-api/vfio.html) GPU Passthrough [^3]. I pass that GPU directly into a Windows VM and use [Looking Glass](https://looking-glass.io/) to stream the video output back to my PC screen with negligible latency.
81
82I've also declaratively configured [**Minecraft Servers**](https://github.com/Infinidoge/nix-minecraft) _(cuz that 2 week period happens every other month for me, don't judge)_.
83
84**At this point most people would stop**
85
86Well I didn't.
87
88I needed to know that my system was _spiritually_ pure. So I formatted my drive with [ZFS](https://github.com/openzfs/zfs) (its own [merits](https://itsfoss.com/what-is-zfs/) aside) and implemented [**Impermanence**](https://github.com/nix-community/impermanence).
89Every time I reboot, my root dataset rolls back to an empty snapshot. Wiped. Gone. My OS comes back from a blank slate every boot, preserving only what I explicitly whitelist on a separate dataset.
90To manage secrets without em dying in the purge, I use [**sops-nix**](https://github.com/Mic92/sops-nix) to encrypt passwords and API keys using GPG, directly into my publicly hosted `git` repo, without leaking any sensitive data.
91
92**The result of all this?**
93
94If I buy a new computer today, I don't spend a week installing drivers and recovering my workflow.
95
96I clone my repository. I run one single command.
97
98~~And I doomscroll~~. Soon as I return [^4], I spin up an AAA Windows game, displayed on a tiling Linux WM (heck, even choose between [Hyprland](https://hypr.land/) and [Niri](https://github.com/YaLTeR/niri)), on a system that deletes and rebuilds itself on every boot.
99
100God, I love NixOS, and I hate it cuz now I can't go back to anything else.
101
102# A Fair Warning
103
104Before you rush off to install this magical operating system, we need to have a serious chat.
105
106**NixOS is hard.**
107
108And I don't mean "Linux is hard" kind of hard. Its more "I have to relearn how everything works" kind of hard.
109
110- **It is not standard Linux**: Most tutorials you find on the internet simply will not work here. You can't just `apt install` your problems away.
111- **The Documentation is... sparse**: Sometimes you will be reading a manual, and sometimes you will be reading 10-year-old Reddit threads praying for an answer.
112- **Patience is key** (_or severe OCD tbh_): If you are not acquainted with the command line, programming languages, random crash logs, or want a computer that "just works" to play games or browse the web, consider yourself warned. Cuz this setup costs time, sanity, and a concerning amount of self-restraint.
113
114# Still Reading?
115
116If you really want to get dirty with Nix and decide to invest oodles of your time into building your own configuration, my [repository](https://github.com/maydayv7/dotfiles) can be used as inspiration.
117You can check out the list of links below to resourceful Nix documentation/tutorials/projects that may be helpful in your endeavour, as they were in mine.
118
119## Links
120
121**See:** A [Curated List](https://github.com/nix-community/awesome-nix) of the best resources in the Nix Community
122**Also:** [This](https://nixos-and-flakes.thiscute.world/) website for beginners starting out with NixOS and Flakes
123
124- Official [Documentation](https://nixos.org/learn.html)
125- NixOS [Manual](https://nixos.org/manual/nixpkgs/stable)
126- Nix [Pills](https://nixos.org/guides/nix-pills/)
127- NixOS [Discourse](https://discourse.nixos.org/)
128- NixOS [Package Search](https://search.nixos.org/)
129- [`nixpkgs`](https://github.com/NixOS/nixpkgs) Package Repository
130- [NUR](https://github.com/nix-community/NUR) Nix User Repository
131- NixOS [Hardware Modules](https://github.com/nixos/nixos-hardware)
132- Home Manager [Options](https://nix-community.github.io/home-manager/options.html)
133
134### Other Sources
135
136- Tweag [Article](https://www.tweag.io/blog/2020-05-25-flakes/) introducing Flakes
137- Serokell's [Blog](https://serokell.io/blog/practical-nix-flakes) on Flakes
138- Jordan Isaac's [Blog](https://jdisaacs.com/series/nixos-desktop/) for porting configuration to Flakes
139- Jon Ringer's [Videos](https://www.youtube.com/channel/UC-cY3DcYladGdFQWIKL90SQ) on general NixOS Tooling and Hackery
140- Justin's [Notes](https://github.com/justinwoo/nix-shorts) on using Nix
141- Lan Tian's Series of [Blog Posts](https://lantian.pub/en/article/modify-website/nixos-initial-config-flake-deploy.lantian/) on NixOS
142- Christine's [Blog Posts](https://christine.website/blog/series/nixos) addressing NixOS Security
143- [Graham's](https://grahamc.com/blog/erase-your-darlings) and [Elis'](https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/) Blog Posts on Ephemeral Partition Schemes
144
145### Other Configurations
146
147Here are some repositories that I may have shamelessly rummaged through for building my `dotfiles`:
148_Thanks a lot! ;)_
149
150- [4JX](https://github.com/4JX/nixos-config)
151- [balsoft](https://code.balsoft.ru/balsoft/nixos-config)
152- [bbigras](https://github.com/bbigras/nix-config)
153- [cole-h](https://github.com/cole-h/nixos-config/)
154- [colemickens](https://github.com/cole-mickens/nixcfg)
155- [davidtwco](https://github.com/davidtwco/veritas)
156- [fufexan](https://github.com/fufexan/dotfiles)
157- [gvolpe](https://github.com/gvolpe/nix-config)
158- [hlissner](https://github.com/hlissner/dotfiles)
159- [jordanisaacs](https://github.com/jordanisaacs/dotfiles)
160- [kclejeune](https://github.com/kclejeune/system)
161- [lovesegfault](https://github.com/lovesegfault/nix-config)
162- [lucasew](https://github.com/lucasew/nixcfg)
163- [nobbz](https://github.com/NobbZ/nixos-config)
164- [rasendubi](https://github.com/rasendubi/dotfiles)
165- [sioodmy](https://github.com/sioodmy/dotfiles)
166- [tejing1](https://github.com/tejing1/nixos-config)
167- [vlaci](https://github.com/vlaci/nixos-config)
168- [wiltaylor](https://github.com/wiltaylor/dotfiles)
169- [wimpysworld](https://github.com/wimpysworld/nix-config)
170
171---
172
173[^1]: [Wiki](https://en.wikipedia.org/wiki/Dependency_hell) for life
174
175[^2]: [Meaning](http://gateway-drug.urbanup.com/2175521) ig
176
177[^3]: [Arch Wiki](https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF) _my love_
178
179[^4]: T&C Apply ;)