In my NixOS flake.nix, I have
outputs =
{ self, nixpkgs, home-manager, ... }@inputs:
{
nixosConfigurations = {
foo = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/forge/default.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.vulcan = import ./shared/desktop/home.nix;
}
];
};
bar = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/snowpi/default.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.vulcan = import ./shared/home.nix;
}
];
};
};
};
This works! But I want to deduplicate the repeated home-manager section, so I tried the following:
outputs =
{ self, nixpkgs, home-manager, ... }@inputs:
let
hm =
hmc: home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.vulcan = import hmc;
};
in
{
nixosConfigurations = {
foo = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/forge/default.nix
(hm ./shared/desktop/home.nix)
];
};
bar = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/snowpi/default.nix
(hm ./shared/home.nix)
];
};
};
};
But I get an error when rebuilding (nixos-rebuild switch --flake .#snowpi
):
error: function 'anonymous lambda' called without required argument 'lib'
at /nix/store/rnq30155xjy9s0w82z8p3wvs1nb46ln6-source/nixos/default.nix:1:1:
1| { config, lib, pkgs, utils, ... }:
| ^
2|
(I also tried importing inside nixosConfigurations, instead (hm (import ./shared/home.nix)
), and got the same error.)
What does this error mean?