Part 1 - Home Manager
The first thing you want to do unless you already done this is to start using Home Manager to manage the home directory. It's an excellent way to configure many programs as the user through a nix configuration file.
However I would advice to use the NixOS module that home manager provides instead of using home manager directly. This way the updates to home manager is done as part of the system generations, as well as rollbacks. The set-up for using the module is fairly straightforward and simple.
Sample module that can be imported into configuration.nix
using imports
:
{ pkgs, ... }: let home-manager = builtins.fetchTarball { url = "https://github.com/nix-community/home-manager/archive/master.tar.gz"; }; in { # Import the home-manager module. imports = [ "${home-manager}/nixos" ]; # Home manager configuration for user jane. home-manager.users.jane = { pkgs, ... }: { programs.home-manager.enable = true; # In here you can do settings for home-manager, these are listed # in the manual available in: $ man home-configuration.nix # In here you can use the "home.file" features of home manager to # link certain files to certain content. However, that's not the # same as linking it to persistent storage since it will copy the # file to the store where it will become read only. That may be # perfectly fine for certain files. For other paths (such as # "~/Downloads/"), it may be quite unsuitable. # Example: Enable network manager applet for this user: services.network-manager-applet.enable = true; }; }
To make this even better, talyz spent quite some time to implement modules to help doing persistence handling better – both in NixOS, but also as a Home Manager module. These modules became the impermanence community project.