this post was submitted on 23 Jul 2024
13 points (100.0% liked)

Nix / NixOS

1758 readers
74 users here now

Main links

Videos

founded 1 year ago
MODERATORS
 

I have started using NixOS recently and I am just now creating conventions to use in my config.

One big choice I need to make is whether to include a unique identifier as the most significant attribute in any options that I define for my system.

For example:

Lets say I am setting up my desktop so that I am easily able to switch between light and dark modes system-wide. Therefore, I create the boolean option:

visuals.useDarkMode

Lets say I also want to toggle on/off Tor and other privacy technologies all at once easily, so I create the boolean:

usePrivateMode

Although these options do not do related things, they are still both custom options that I have made. I have the first instinct to somehow segregate them from the builtin NixOS options. Let's say my initials are "RK". I could make them all sub-attributes of the "RK" attribute.

rk.visuals.useDarkMode

rk.usePrivateMode

I feel like this is either a really good idea or an antipattern. I would like your opinions on what you think of it and why.

you are viewing a single comment's thread
view the rest of the comments
[–] dbx12@programming.dev 6 points 3 months ago

I basically know nothing about NixOS, but name spacing is usually a good idea to avoid conflicts / shadowing in config files.