---
title: One configuration language to rule them all
date: 2024-11-21
permalink: daily/2024/11/21/one-configuration-language-to-rule-them-all
tags:
  - software-development
  - linux
  - nix
cta: ~
snippet: |
  No more YAML, TOML, INI or JSON configuration files for me.
---

I started using the Nix package manager [in September 2022][0] as a replacement for Ansible.

Since then, I've switched to daily-driving NixOS as my main operating system and Home Manager to manage my dotfiles (configuration files for managing application settings, like Neovim, tmux and Alacritty).

A benefit I didn't initially think of was that now I can write all my configuration files in the Nix language.

I don't need to write YAML, TOML, INI or JSON configuration files. Nix and Home Manager will convert it for me.

For example, see [my Git configuration written in Nix][1] which is converted and written to .gitignore.

And, if there isn't a built-in module for what I need, there are functions like `toJSON` that will convert Nix code to JSON that I can write to a file.

This is also great if a program changes its configuration file language, which Alacritty did recently.

They changed from YAML to TOML and I didn't need to change anything.

Nix has become my one configuration language to rule them all.

[0]: https://github.com/opdavies/dotfiles.nix/commit/af1d8d37
[1]: https://github.com/opdavies/dotfiles/blob/172b7c9ca61d2dd6ffdc967af9102b1ca24edd81/nix/modules/home-manager/git.nix#L25