---
title: Declarative user management
---
= Declarative user management

Similarly to xref:../01-declarative-host-management/index.adoc[Declarative host management], this project also provides a way to declare home-manager users.
This is also presented as a custom flake-parts module as well, ready to be configured at `setups.home-manager` namespace of the flake-parts config.

This module is a bit simpler that it only makes configured users to be added to `homeConfigurations` and `deploy.nodes`.

Here's an example user with complete schema.

.A user with complete schema
[source, nix]
----
{
  setups.home-manager.sharedModules = [
    inputs.your-mom.homeModules.default
  ];

  # Here is the meat, what you're likely going to do.
  setups.home-manager.configs.foo-dogsquared = {
    systems = [ "x86_64-linux" "aarch64-linux" ];
    nixpkgsBranch = "nixos-stable";
    homeManagerBranch = "home-manager-23.05";
    homeDirectory = "/home/foo-dogsquared";
    username = "foodogsquared";
    modules = [
      ({ config, lib, ... }: {
        services.foo.enable = true;
      })
    ];
    overlays = [
      inputs.neovim-nightly-overlay.overlays.default
    ];
    deploy = {
      hostname = "local.foodogsquared.one";
      fastConnection = true;
      autoRollback = true;
      magicRollback = true;
      remoteBuild = true;
    };
  };
}
----