Add daily email for 2024-11-29

Managing dotfiles with Nix
This commit is contained in:
Oliver Davies 2024-12-02 23:26:18 +00:00
parent 1640dd72ec
commit 7437f01ab3

View file

@ -0,0 +1,35 @@
---
title: Managing dotfiles with Nix
date: 2024-11-29
permalink: daily/2024/11/29/managing-dotfiles-with-nix
tags:
- software-development
- linux
- nix
- nixos
cta: ~
snippet: |
I use Nix and Home Manager to manage my dotfiles and configure the programs I use, and it works on NixOS and standalone.
---
[As well as Nix managing packages][0] and [NixOS as your operating system][1], you can use Nix to manage your user configuration and dotfiles.
Enter, Home Manager.
Home Manager is available as a module for NixOS and a standalone package for other Linux distributions and macOS.
With it, you can install and configure programs for specific users and create and manage dotfiles such as .gitconfig, .tmux.conf and .zshrc instead of using a tool like Stow.
There's also the extra benefit that [you can write these files in the Nix language][2] and only focus on one configuration language.
Nix and Home Manager will create the desired output file in whatever the program wants, whether it's JSON, ini, YAML or something else.
A good example is [my .gitconfig configuration][3]. It includes settings for Git itself, aliases, global excludes, adds extra packages such as [git-instafix][4] and some environment variables.
All in one file and all in one language.
[0]: {{site.url}}/daily/2024/11/25/nix-the-package-manager
[1]: {{site.url}}/daily/2024/11/27/nix-as-an-operating-system
[2]: {{site.url}}/daily/2024/11/21/one-configuration-language-to-rule-them-all
[3]: https://github.com/opdavies/dotfiles/blob/3acd73f6a2e19eadcc16baf22afad5dfad5e049b/nix/modules/home-manager/features/cli/git.nix
[4]: https://zet.oliverdavies.uk/notes/10