I have a configuration with home manager as a module
imports =
[
<home-manager/nixos>
./users.nix
];
I have a “users” file imported which contains a non-home manager user (users.users.panic) and a home-manager managed:
home-manager.users.john = { pkgs, … }: {
(with programs, stateversion, packages etc)
}
This works fine.
Trying to convert to flakes, I created a flake.nix (in /etc/nixos) - the simplest flake I can find…
{
outputs = { self, nixpkgs }: {
nixosConfigurations.Damage = nixpkgs.lib.nixosSystem {
system = “x86_64-linux”;
modules = [ ./configuration.nix ];
};
};
}
I then try to build using nixos-rebuild build and get the following error:
error: cannot look up ‘<home-manager/nixos>’ in pure evaluation mode (use ‘–impure’ to override)
If I comment out the module, I get the error:
error: The option home-manager' does not exist. Definition values: - In
/nix/store/hih9wbavvsqnfvp6rcsmxkqj9msyl8kd-source/users.nix’:
{
users = {
john = <function, args: {pkgs}>;
};
}
So clutching at straws, reading lots more articles, I tried adding inputs -
{
inputs = {
nixpkgs.url = “nixpkgs/nixos-22.11”;
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
Still the same…
So I am thinking that the syntax in users file might be wrong given the error message, but I cannot find anything that might help.
Any pointers to my (I suspect) silly mistake! - Thanks