Nixos-rebuild fails after Home Manager installation

New to NixOS and trying to set up Home Manager. I followed the instructions for installation as a NixOS module from the Home Manager manual. I follow the unstable NixOS packages channel, so I added Home Manager master.

I added the import line described by the manual such that the imports section of my configuration.nix now looks like this:

imports = 
  [
    ./hardware-configuration.nix
    <home-manager/nixos>
  ];

I also added the following section later in configuration.nix:

home-manager.extraSpecialArgs = { inherit unstable };
home-manager.users.myUserName = { pkgs, ... }: {
  home.packages = [
    pkgs.atool
    pkgs.httpie
  ];
};

When I attempt sudo nixos-rebuild switch, I get the following errors:

error:
  ... while evaluating the attribute 'config.system.build.toplevel'
      at /nix/store/a_very_long_hash_goes_here-nixos/nixos/lib/modules.nix:320:9:

      319|            options = checked options;
      320|            config = checked (removeAttrs config [ "_module" ]);
         |            ^
      321|            _module = checked (config._module);

 ... while calling the 'seq' builtin

      at /nix/store/a_very_long_hash_goes_here-nixos/nixos/lib/modules.nix:320:18:

      319|            options = checked options;
      320|            config = checked (removeAttrs config [ "_module" ]);
         |                     ^
      321|            _module = checked (config._module);

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

       error: syntax error, unexpected '=', expecting ';'

       at /etc/nixos/configuration.nix:66:36:

        65|     # Enable touchpad support (enabled default in most desktopManager).
        66|     services.xserver.libinput.enable = true;
          |                                      ^
        67|

However, commenting out or outright removing all the lines pertaining to Home Manager from my config does nothing; neither does removing the Home Manager channel. In that way it seems unrelated to Home Manager, but the last rebuild I did shortly before installing Home Manager went off without a hitch, and the only thing I changed between then and now was installing Home Manager.

Also don’t have much experience, but there does seem to be a syntax error in your configuration.nix. I assume there is a missing ; in the end of the line before line 66

1 Like

What does your configuration.nix at line 66 look like?