Hi everyone, I’m trying to setup home-manger as a module in my flake.
I am getting the following error while trying to rebuild and I’m a bit lost:
error: A definition for option `home-manager.users.modules' is not of type `Home Manager module'. Definition values:
- In `/nix/store/ws4gp4ahcmjdbyf9p1rlpmw42pzgziak-source/hosts/homebase/home-manager.nix':
[
/nix/store/ws4gp4ahcmjdbyf9p1rlpmw42pzgziak-source/hosts/homebase/home.nix
/nix/store/ws4gp4ahcmjdbyf9p1rlpmw42pzgziak-source/homeManagerModules
]
My current directory structure is as follows:
~/nixosConfig master ~ • ➜ tree .
.
├── flake.lock
├── flake.nix
├── homeManagerModules
│ ├── alacritty.nix
│ ├── default.nix
│ ├── desktop.nix
│ ├── direnv.nix
│ ├── nixpkgs.nix
│ ├── starship.nix
│ ├── tmux.nix
│ └── zsh.nix
├── hosts
│ └── homebase
│ ├── bluetooth.nix
│ ├── configuration.nix
│ ├── hardware-configuration.nix
│ ├── home-manager.nix
│ ├── home.nix
│ └── nvidia.nix
My flake.nix
has the following relevant lines:
outputs = { self, nixpkgs, ... }@inputs : {
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./hosts/homebase/configuration.nix
./nixosModules
];
};
homeManagerModules.default = ./homeManagerModules;
};
My configuration.nix
imports home-manager.nix
which has the following contents:
{inputs, ...}:
let user = "<my_username>";
in
{
home-manager = {
extraSpecialArgs = { inherit inputs; };
users = {
"${user}" = import ./home.nix;
modules = [
./home.nix
inputs.self.outputs.homeManagerModules.default
];
};
};
}
And finally my home.nix
is as follows:
{ config, pkgs, ... }@inputs:
in
{
imports = inputs.self.outputs.homeManagerModules.default;
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "<my_username>";
home.homeDirectory = "/home/<my_username>";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "24.05"; # Please read the comment before changing.
....
and homeManagerModules/default.nix
:
{lib, ...}:
{
imports = [
./nixpkgs.nix
./alacritty.nix
./zsh.nix
./starship.nix
./tmux.nix
./direnv.nix
./desktop.nix
];
}
What on earth could I be doing wrong here aha