users | Skill Performance & Reviews | TopRankSkills

TopRank Skills

Home / Skills / tools / users

users

maintained by DaRacci

star 17 account_tree 0 verified_user MIT License
bolt View GitHub

name: users description: Add and configure new Home-Manager users

Users

User Directory Structure

Each user has a directory in home/<username>/:

home/<username>/
  hm-config.nix       # Main Home-Manager entry point
  os-config.nix       # NixOS config applied to all hosts (optional)
  secrets.yaml        # User-specific secrets (optional)
  id_ed25519.pub      # User's SSH public key
  <hostname>.nix      # Host-specific config (one per host, optional)
  features/           # User's feature modules (optional)

Creating a New User

1. Create user directory

mkdir -p home/newuser

2. Create host-specific configuration

Create home/newuser/<hostname>.nix for each host the user will use:

# home/newuser/nixmi.nix
{ pkgs, lib, ... }:
{
  imports = [
    # Import shared configurations
    ../shared/features/cli
    ../shared/desktop/common
  ];

  programs.git = {
    userName = "Your Name";
    userEmail = "your.email@domain.com";
  };
}

3. Create hm-config.nix (shared config)

# home/newuser/hm-config.nix
{ ... }:
{
  # Configuration shared across all hosts
  programs.bash.enable = true;

  home.sessionVariables = {
    EDITOR = "vim";
  };
}

4. Create os-config.nix (optional)

For NixOS settings that should apply to all hosts where this user exists:

# home/newuser/os-config.nix
{ pkgs, ... }:
{
  # This is NixOS config, not Home-Manager
  users.users.newuser = {
    extraGroups = [ "docker" "libvirtd" ];
  };
}

User-Host Binding

The system automatically links users to hosts based on file existence:

  • If home/<username>/<hostname>.nix exists, that user is configured on that host
  • The user's os-config.nix is applied to the host's NixOS config
  • The user's home-manager config is built as homeConfigurations."<user>@<host>"

User Secrets

Create home/<username>/secrets.yaml for user-specific secrets:

SSH_PRIVATE_KEY: |
  -----BEGIN OPENSSH PRIVATE KEY-----
  ...
  -----END OPENSSH PRIVATE KEY-----

Update .sops.yaml to include the user's age key for their secrets path.

Shared User Configurations

Common configurations live in home/shared/:

Path Purpose
home/shared/global/ Applied to all users
home/shared/applications/ Application configs (browsers, editors)
home/shared/desktop/ Desktop environment configs
home/shared/features/cli/ CLI tool configurations

Import these in user configs:

{
  imports = [
    ../shared/features/cli
    ../shared/applications/browser.nix
  ];
}

Testing User Configuration

# Build home-manager configuration
nix build .#homeConfigurations.newuser.activationPackage

# Or use home-manager directly
home-manager build --flake .#newuser

See also: docs/Creating-Users.md

chat Comments (0)

chat_bubble_outline

No comments yet. Be the first to share your thoughts!

Skill Details

GitHub Stars 17
GitHub Forks 0
Created Jan 2026
Last Updated 5 months ago
tools tools system admin

Related Skills

docker-expert
chevron_right
discord-governance
chevron_right
caffeine
chevron_right
hetzner-provisioner
chevron_right
telnyx-network
chevron_right

Build your own?

Join 12,000+ developers contributing to the Claude ecosystem.