My Ideal Nix Setup
This is NOT a NixOS setup tutorial. Just a yap on how I started using NixOS and how I randomly found a home-like setup.
Back in November of 2024 I decided to try out NixOS out of curiosity of seeing all the people on r/unixporn using it. I was curious about all the hype and everything going on with NixOS. People talking about Nix being the ultimate and next-gen Linux Distro and what made me even more curious was it being declarative and reproducible. As being a person who always moved from one Linux distro to another almost every week or two I decided to try it on a random weekend of that November.
First Attempt
So, I finally installed NixOS on my PC and didn’t know what to do and how, even tho there was an option of using it as a package manager first or atleast use it inside a Virtual Machine could’ve been a better kickstart but well I went in blind thinking “Nix is just another Linux distro and if I can deal with Arch Linux installation I can do this too”.
Installing it was no big deal just went for nomodeset, and typical Calamares installer options and voila!! Welcome to NixOS!! Now what?? How do I install packages in this? Where is my pacman
?? So dumb of me for not doing even this one thing of searching if it’s based on some other distro or what LMAO.
Then I looked up on manuals and nixos wiki about how to install and use packages and to be very honest it felt exhausting why do I have to write sudo nixos-rebuild switch
just because I added a new package?? why is nix
not as simple as something like apt
or pacman
?? (what else do you expect going in blindly you dumb hooman bean??)
Then I found out about Vimjoyer’s youtube channel and watched some videos of him and somehow managed to configure some basic stuff and it was pretty much usable but wait- I didn’t realize I messed up something while I was messing around checking “why is this distro weird??” and for some VERY VERY good reasons NIX_LD_LIBRARY_PATH
got messed up and no libraries would get detected automatically (Yes I messed up my system paths COMPLETELY). I tried setting up my usual work stuff and here we go most basic glibc
is missing. Setup a shell.nix
and get it working somehow? check. Extra brainfuck for free? check.
That was VERY dumb and stupid and everything else possible in stupidity world and after 4 days of messing around with “Why do I have to add libraries manually just to get some X thing to work? This concept is so fucking dumb.” I went back to usuals of having EndeavourOS and living a peacefully self-questioning life of why is Nix so weird.
Second Attempt
Mid of December 2024 (wdym I’m always thinking about trying out some new distro? LOL) I decided to give Nix another try. I thought I was just dumb and fucked up something and now I had some knowledge of how to setup nix (initially) and on top of that I also looked up some blogs on how people set up their nix from base so I installed it again on yet-another-weekend. This time I used unofficial NixOS & Flakes Book and it has the cutest domain I’ve ever seen. Using this book I managed to setup my base Nix Configuration, Flakes and Home-Manager. I was happy with how it turned out and that NIX_LD_LIBRARY_PATH
issue was not long there (ofc it happened because of my messups).
Then I slowly started learning more about how to use Flakes and work with development environments. Mostly, I’m working with go, python & rust and almost everything is available in NixOS Packages. There’s even nodePackages
for adding some specific node packages to path or in your dev environment which is dope ofc.
Here’s my current NixOS config tree. I love my setup.
❯ tree . -I "*.png" -I "*.jpg"
.
├── btop
│ ├── btop.conf
│ ├── btop.log
│ └── themes
├── config.nu
├── configuration.nix
├── extras
│ ├── emacs
│ │ └── config.el
│ ├── nushell
│ │ └── config.nu
│ ├── tmux
│ │ └── tmux.conf
│ ├── waybar
│ │ └── style.css
│ └── wofi
│ └── style.css
├── flake.lock
├── flake.nix
├── glow
│ └── glow.yml
├── hardware-configuration.nix
├── home.nix
├── modules
│ ├── config.nix
│ ├── files.nix
│ ├── packages.nix
│ └── programs.nix
├── README.md
├── scripts
│ ├── keyboard_toggle.sh
│ └── power-menu.sh
└── wlppr
13 directories, 21 files
Setting up things on nix+home-manager feels super intuitive now, for example here’s how I setup ghostty in my programs.nix
ghostty = {
enable = true;
package = pkgs.ghostty;
settings = {
theme = "Kanagawa Dragon";
font-size = 10;
font-family = "0xProto Nerd Font";
keybind = [
"ctrl+h=goto_split:left"
"ctrl+l=goto_split:right"
];
window-decoration = false;
gtk-titlebar = false;
window-padding-x = 8;
window-padding-y = 8;
window-inherit-working-directory = true;
copy-on-select = true;
adjust-underline-position = 4;
mouse-hide-while-typing = true;
mouse-scroll-multiplier = 1;
cursor-invert-fg-bg = true;
selection-invert-fg-bg = true;
bold-is-bright = true;
cursor-style = "underline";
background-opacity = 1;
background = "0d0c0d";
foreground = "c5c5c9";
adjust-cell-height = "12%";
adjust-cell-width = "2%";
gtk-single-instance = true;
};
themes = {
kanagawa-dragon = {
background = "0d0c0d";
foreground = "c5c5c9";
};
};
};
Before this I had ~/.config/nixcfg/home.nix
and ~/.config/nixcfg/ghostty/config
then I’d symlink ghostty
directory to ~/.config/ghostty
(I wasn’t just ready to try home-manager at that time).
{
config,
pkgs,
...
}: let
configPaths = [
{
name = "ghostty";
path = "${config.home.homeDirectory}/.config/nixcfg/ghostty";
}
{
name = "some-other-config";
path = "${config.home.homeDirectory}/.config/nixcfg/some-other-config";
}
];
in {
xdg.configFile = builtins.listToAttrs (map (c: {
name = c.name;
value = {
source = config.lib.file.mkOutOfStoreSymlink c.path;
};
})
configPaths);
}
This method was a quick-fix for having all my config inside nixcfg
directory while also having my typical dotfiles.
With time, I moved from using Gnome to using Hyprland. From using NeoVim to using Helix and I’m also setting up Emacs for my secondary editor and notes-taking and from fish shell to nushell (it’s soo soo good). I’m still working on improving and modularizing my Nix config though. Currently all programs.<whatever-package>
things are inside /nixcfg/modules/programs.nix
and I’ll move them to their individual files (helix.nix, emacs.nix, hyprland.nix, …).
Fun part is my distrohopping stopped and I’m happy with my Nix setup. I can have different flake environments for different projects without having any dependency issues. In my nix config I have weekly garbage collection enabled in-case I forget to cleanup unwanted stuff from nix store.
nix = {
settings = {
experimental-features = ["nix-command" "flakes"];
auto-optimise-store = true;
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 7d";
};
};
There’s a lot you can do on NixOS once you learn how to use it properly. There’s also GUIX that I want to try someday but I just don’t want to mess around with my current nix setup and want to move it to proper satisfaction level… which it already is at but still there’s some stuff that’s still WIP.
Current Setup
- OS: NixOS 25.05
- WM: Hyprland
- Bar: Waybar
- Term: Ghostty
- Editor: Helix & Emacs
- Browser: Brave Browser
Dotfiles —> HERE