Home-manager install as module in flake - .users option and home-manager CLI not available

Hi everyone,
I’m pretty new to NixOS (coming from years of Arch, btw). So please bare with me :slight_smile:

I have a flake based configuration and followed official Flake install instruction at Home Manager Manual

  description = "A Nix flake for my personal system configuration";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
    flake-utils.url = "github:numtide/flake-utils";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

  outputs = inputs@{ nixpkgs, home-manager, ... }: {
    nixosConfigurations = {
      tuxedonix = nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
            home-manager.useGlobalPkgs = true;
            home-manager.useUserPackages = true;
            home-manager.users.gbr = import ./home-manager/home.nix;

            # Optionally, use home-manager.extraSpecialArgs to pass
            # arguments to home.nix
{ config, pkgs, ... }:

  home.username = "gbr";
  home.homeDirectory = "/home/gbr";
  home.stateVersion = "23.11"; # Please read the comment before changing.
  home.packages = [

  home.file = {

  home.sessionVariables = {
    # EDITOR = "emacs";

  # Let Home Manager install and manage itself.
  programs.home-manager.enable = true;
{ config, pkgs, ... }:


  imports =
    [ # Include the results of the hardware scan.
      #include all modules from nixos/modules

  # enable flakes 
  nix.settings.experimental-features = [ "nix-command" "flakes" ];

  nixpkgs.config = {
    allowUnfree = true;

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "23.11"; # Did you read the comment?


nixos-rebuild switch --flake ~/nix-config/#tuxedonix errors out

error output
nixos-rebuild switch  --flake ~/nix-config/#tuxedonix
building the system configuration...
       … while calling the 'head' builtin

         at /nix/store/7q4y8idjk2di380j1fxn4k7wx9y935cl-source/lib/attrsets.nix:922:11:

          921|         || pred here (elemAt values 1) (head values) then
          922|           head values
             |           ^
          923|         else

       … while evaluating the attribute 'value'

         at /nix/store/7q4y8idjk2di380j1fxn4k7wx9y935cl-source/lib/modules.nix:807:9:

          806|     in warnDeprecation opt //
          807|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          808|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: attribute 'attrTag' missing

       at /nix/store/0b11p5g24mgl5qfg34khvjs3fh91vdx4-source/modules/services/kanshi.nix:9:19:

            9|   directivesTag = types.attrTag {
             |                   ^
           10|     profile = mkOption {

I really wish those errors were less cryptic…

I discovered that home-manager.users.gbr = import ./home-manager/home.nix; in flake.nix causes the error. When I comment it out, the build goes through.
But home-manager CLI is not available. So it seems, it did not get installed from the flake.
In the HM docs for installing as a Nix Module (no flake) it says

It is then possible to add
imports = [ <home-manager/nixos> ];
to your system configuration.nix file, which will introduce a new NixOS option called home-manager.users whose type is an attribute set that maps user names to Home Manager configurations.

This and the missing home-manager CLI command seems to confirm that hm does not get installed and home-manager.users option is not available. Hence the error.

I thought that installing HM in my flake inputs will make it available to the config. So I seem to be missing a vital installation step?
But the docs don’t mention a separate installation step being required.

I did a nix flake update which downloaded some stuff, but error persists.

Also did nix-collect-garbage -d and rm -rf ~/.cache/nix. No luck.

I’ve been going around circles for hours already, Have watched numerous YT vids, read all installation related threads I could find here and searched and read tons on the web. To no avail.

Now I’m stuck and really would appreciate your help.

I don’t think this has anything to do with home manager. The error message states that an expected attribute is missing. In this case, it is the type type.attrTag.

The type lib.type.attrTag was added only recently. The problem is that the Kanshi service is using this tag already and thus only works with the unstable branch.

       error: attribute 'attrTag' missing

       at /nix/store/0b11p5g24mgl5qfg34khvjs3fh91vdx4-source/modules/services/kanshi.nix:9:19:

            9|   directivesTag = types.attrTag {
             |                   ^
           10|     profile = mkOption {

Try switching to unstable nixpkgs. In your flake file change nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; to nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

1 Like

Thanks a lot. This worked and I wanted to switch to unstable anyways.