Minimal home-manager module giving cryptic error

I’ve got a flake which imports a system configuration and attempts to set up a home manager profile for a single user:

{
	description = "NixOS system configurations.";

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

	outputs = { self, home-manager, nixpkgs, ... }@inputs:
		let
			system = "x86_64-linux";
			stateVersion = "23.11";
			configRoot = self;
			specialArgs = {
				inherit home-manager nixpkgs system stateVersion configRoot;
			};
		in {
			nixosConfigurations = {
				inherit system;
				panza = nixpkgs.lib.nixosSystem {
					inherit specialArgs;
					modules = [
						./hosts/panza.nix
						home-manager.nixosModules.home-manager
						{
							home-manager.useGlobalPkgs = true;
							home-manager.useUserPackages = true;
							home-manager.users.foo = import ./users/foo/home.nix;
						}
					];
				};
			};
		};
}

I’m just getting started with home manager and tried to get a minimal example working as per the manual. Here’s my home.nix:

{ config, pkgs, ... }:

{
	home.username = "foo";
	home.homeDirectory = "/home/foo";
	home.stateVersion = "23.11";
	programs.home-manager.enable = true;
}

Very cryptically, I get something like the following:

error:
       … while calling the 'head' builtin

         at /nix/store/xsg83y47j760awlvd32jiy06ifd6drgl-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/xsg83y47j760awlvd32jiy06ifd6drgl-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:

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

I can post the system config too but it’s fairly close to the default one provided by the nixOS installer and I don’t think anything there is causing this problem. This is just bizarre to me, as I guess Kanshi is a display profile tool for wayland and my system only uses X for now. Any ideas?

As stated in the Releases section of home-manager’s readme, they develop home-manager against the nixpkgs-unstable branch. Here in the flake inputs, you’re mixing Nixpkgs from the nixos-23.11 branch and home-manager from the default branch, which causes problems when home-manager refers to something that’s only available on unstable Nixpkgs.

You can either:

  • Use home-manager from their release-23.11 branch.
  • Use Nixpkgs from nixpkgs-unstable.
4 Likes

That was it, thank you very much.