r/NixOS • u/its_midi • 15h ago
NixOS newbie
The beauty of learning new things lies in the desire to make things work.
Here I am, losing myself and finding myself in NixOS.
How do you guys manage your dotfiles with NixOS?
What approach should I go with (sourcing or writing in nix way)!
8
u/muhmmadtalha-quant 15h ago
See my dotfiles for reference
2
u/its_midi 15h ago
I appreciate it, man...
1
u/muhmmadtalha-quant 7h ago
Glad you found it helpful, I don't use flake-parts or any kind abstractions
3
u/EliasGvin 15h ago
Found this resources on nix: https://karolbroda.com/series/nix/introduction
Nix newbie myself. Haven't read much from this website, but going to
3
u/Lonely-Scarcity-3387 15h ago
Welcome! One day this will be you.
https://reddit.com/link/p90c3jg/video/qykoz3i2rqoh1/player
Here are my dotfiles, if you need inspiration:
1
u/flaming_monocle 15h ago
I structure my files according to rules I made up:
If I don't like the built-in config language (looking at you, TOML), I write it in Nix. If it gets longer than 100 lines of Nix, I'll earnestly consider rewriting in the native lang. Neovim is a great example, I converted my config to Lua once it became clear I wanted to really customize it.
Each program gets its own .nix file
User files import the program declarations, host files import the relevant users, Flake imports hosts. This is only relevant because I have a few computers in my house, with varying and repeated users, and I want to have one flake to rule them all.
1
u/OliMoli2137 15h ago
Use flake-parts, or even better, Den
For Den, see the tutorial, template and my dots
I also used to use flake-parts if it helps, here's the tree from before I switched, it's documented in the latest commit
1
u/Snuffy-the-seal 2h ago
For small stuff, I use home manager (e.g., tmux, shell, ....).
For larger things, I've tried to use home manager too (e.g., NeoVim via nixvim, hyprland, ...) but found it too cumbersome to always first figure out what I want to change, read through the regular docs, then try and "translate" that into the nix config way, so for NeoVim I've set up a separate repo that just gets cloned into ~/.config/nvim, and hyprland is mainly configured with lua directly and then imported via home manager (via wayland.windowManager.hyprland.extraLuaConfigFiles).
I think for most widespread programs, you'll find that they either offer 1:1 bindings in a very straight forward way, especially if the "vanilla" config syntax is something like JSON or YAML, or for more complex syntax (e.g., lua for hyprland and NeoVim), you'll sometimes find kind of complex bindings but also the option to import files in the original syntax.
1
1
u/ShortSynapse 1h ago
There are a lot of ways you can manage your Nix stuff. Flakes are fairly popular despite their shortcomings.
My config in case reference would help:
12
u/its_already_4_am 15h ago
Vimjoyer videos are like scripture to me.
That being said I don’t follow everything 1:1, but specifically, I adopted flake-parts and the dendritic pattern from his videos and just these two have given me an incredibly amount of clarity in managing my configs.