home-manager

home-manager

Summary

  • is a configuration management tool for the Nix package manager that allows users to manage and customize their user environment, including their shell configuration, system services, and desktop applications
  • users can define their environment configuration in a single file, using the Nix configuration language
    • configuration file can specify things like the user’s shell and shell configuration, their desktop environment and window manager, their preferred applications and tools, and other user-specific settings

Generate a home-manager configuration within a flake

mkHomeConfig = {
  username,
  system ? "x86_64-linux",
  nixpkgs ? inputs.nixpkgs,
  stable ? inputs.stable,
  baseModules ? [
    ./modules/home-manager
    {
      home = {
        inherit username;
        homeDirectory = "${homePrefix system}/${username}";
        sessionVariables = {
          NIX_PATH = "nixpkgs=${nixpkgs}:stable=${stable}\${NIX_PATH:+:}$NIX_PATH";
        };
      };
    }
  ],
  extraModules ? [],
}:
  inputs.home-manager.lib.homeManagerConfiguration rec {
    pkgs = import nixpkgs {
      inherit system;
      overlays = builtins.attrValues self.overlays;
    };
    extraSpecialArgs = {inherit self inputs nixpkgs;};
    modules = baseModules ++ extraModules;
  };

Notes mentioning this note