Hacker News new | ask | show | jobs
by hiimshort 873 days ago
Home-Manager is a project that brings declarative user home directory management to Nix. You can have it set up dotfiles, user systemd services, etc. All the things to do with stuff in your home directory.

The documentation for Home-Manager that is generated is an extremely large html file with every option listed. It is not easy to read or discover options in. The linked tool provides a search field to query the available options for Home-Manager, making it much easier to digest. This is similar to the NixOS Options search tool which does the same job of providing search for NixOS options.

2 comments

Thanks, I thought it was some kind of home (house) automation. Do you have an example of what it's useful for? Why would I "manage" my home directory?
Declarative home environments are pretty great. Being able to reproduce your entire user setup is fantastic when you manage multiple machines or want to make future migrations.

I run NixOS and use Home-Manager as well. This lets me define my entire system in addition to my user home contents declaratively. So with this configuration I can apply NixOS & Home-Manager to get the same results anywhere.

Here is an example of my Home-Manager configuration: https://github.com/jakehamilton/config/blob/a3da20eeab74a50a...

In this example I configure Git. This gets written to my user home's config directory.

Where the "home config" in this case can be much more than just text files and, for example, can include the actual apps installed locally. So when you define your `.git/config` file, you can include `diff.external = ${pkgs.difft}` to refer to a locally installed version of app `difft` and home-manager does the right thing. You can also manage your user services through systemd or launchd.
The stuff Nix lets you declare really are very arbitrary. I even specify my Firefox extensions in my home-manager config.
Many command line programs keep their configurations somewhere under $HOME. These are often called "dotfiles".

If you ever use more than one machine, likely you'll want the same configuration available on all those machines.. so you'll want some way to copy them to a new machine.

Some dotfile managers are quite simple, like dotbot. https://github.com/anishathalye/dotbot

Home Manager from the Nix community is a bit more sophisticated. It allows for writing configurations in the Nix language, which is nice if you know/like Nix. (Nix is a powerful/expressive package manager. Nix is to apt-get what vim is to notepad).

Can this be used without using Nix at system level?
It can be used on non-NixOS Linux distributions and Mac OS.

https://nix-community.github.io/home-manager/index.xhtml#sec...