Home Blog About Me Projects Cats Rhythm games Nix

Table of Contents

Nix Naming Conventions

As I’ve been using nix for some time now, I’ve been adding more and more modules to my config.

But one thing is slowly starting to be annoying with each nix flake update.

Naming conventions

In nix, there are things called options, which come from modules. The default NixOS modules are pretty consistent in their naming and are easy to guess or to remember.

For example:

environment.sessionVariables = {
 "EDITOR" = "emacs";
};

nixpkgs.config.allowUnfree = true;

Generally, for each whitespace for a new word, there is a capital letter, or if you want a proper name for that, it’s Camel Case.

Of course, there are some options that use dashes (Kebab Case) instead, like:

nix.settings = {
 use-xdg-base-directories = true;
 warn-dirty = ...;
 experimental-features = [...];
};

But they are rare and mostly come from .conf scheme as nix is configured in conf format on non-NixOS systems.

There are modules that follow that naming convention, such as Home-Manager. Its syntax for options is the same as the main NixOS modules.

Sadly, it’s not always the case.

Nixvim

I don’t change my nixvim config that often as it’s not my main editor, but I do have a somewhat feature-complete config if I ever need to switch from Emacs.

One thing that annoys me the most about nixvim is that when I update my flake, I sometimes get errors such as:

warning: The option plugins.none-ls.updateInInsert’ defined in /nix/store/hppg63y2h1y7f1ci0liiv305rzcicj5g-source/config/lsp/none-ls.nix’ has been renamed to `plugins.none-ls.settings.update_in_insert’

As you can see, for whatever reason, the option got modified from the regular NixOS module way of writing it to Snake Case. Like why?

The weirdest thing is the project started out with basically all options in camel case, and over time it’s changing to snake case, but it’s not consistent with it. It’s really annoying, especially when I get a wall of warning just because somebody decided that now this thing should be slightly different and become an annoyance to a user.

I don’t want to modify my config with each update because of things like that.

Note This post is a rant; I have nothing against anyone that creates modules that I use. In fact, I'm happy that I can do so much in nix thanks to other people's contributions.