this post was submitted on 23 May 2025
19 points (100.0% liked)

Nix / NixOS

2204 readers
72 users here now

Main links

Videos

founded 2 years ago
MODERATORS
 

I think it's about time I improved a bit on my Nix and NixOS knowledge, and I guess the best way is having someone more experienced critique my monstrosity of a setup.

Maybe it's too modular? Not modular enough? Convoluted? Complete garbage altogether?

Go to the repo and find out! Just be sure to let me know after.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 5 points 21 hours ago (2 children)
[โ€“] [email protected] 4 points 19 hours ago (1 children)

I read your issue and you left some great advice. Thank you for taking the time to write something thoughtful! As you probably guessed I really had barely any idea of how the module system worked, but it's nice seeing it's a bit similar to Rust's. I will look into the switch script, which will be convenient, and apply your suggestions, since I basically agree with all of them ๐Ÿ™Œ

[โ€“] [email protected] 2 points 19 hours ago
[โ€“] [email protected] 2 points 20 hours ago (1 children)

recursiveMerge

Can you explain how you would use this here? Would this make files like this in my config unnecessary?

[โ€“] [email protected] 3 points 19 hours ago (1 children)

I wasn't very clear in how I wrote those points, I think you got it backwards.

My points was that OP was using recursiveMerge, and I think that is not a very common or useful pattern to follow, because you evade the module system, for no good reason(?).

I think you are already following the most common pattern out there. If you would like to, there are ways to avoid having a default.nix file for each module, but in my opinion that only makes it harder for other people to understand your modules.

[โ€“] [email protected] 2 points 19 hours ago

Okay thanks I was very confused bc I had never seen that as advice anywhere haha