I’m trying to learn Nix and I’m following along this video and it has been quite helpful, however, when configuring home-manager as a module via flakes I’m stuck.
sudo nixos-rebuild switch --flake.#mike
returns:
flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."mike".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."mike".config.system.build.nixos-rebuild' or 'nixosConfigurations."mike".config.system.build.nixos-rebuild'
The entire flake.nix file:
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = github:nix-community/home-manager;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = nixpkgs.lib;
in {
nixosConfigurations = {
MAIN = lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
./hardware-configuration.nix
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.mike = {
imports = [ ./hosts/MAIN/home.nix ];
};
}
];
};
};
nixbook = lib.nixosSystem {
inherit system;
modules = [
./configuration.nix
./hardware-configuration.nix
];
};
};
}
What have I missed?