nix-community / flakelight

Framework for simplifying flake setup [maintainer=@accelbread]
MIT License
227 stars 5 forks source link

Autoloading of nixDir/nixConfigurations does not work #2

Closed noverby closed 1 year ago

noverby commented 1 year ago

With the following Nixos Configuration:

# nixosConfigurations/system.nix
{inputs, ...}:
inputs.lib.nixosSystem {
  system = "x86_64-linux";
  modules = [];
}

I get the following error:

❯ sudo nixos-rebuild build --flake .#system
building the system configuration...
error: A definition for option `nixosConfigurations.system' is not of type `nixosConfiguration'. Definition values:
 In `/nix/store/ksaq37y8nn0w6a1hxianxr19n327abq0-source/builtinModules/nixDir.nix': <function, args: {inputs}>
accelbread commented 1 year ago

Hi, thanks for the report!

This was because the NixOS configuration attribute values have to be the actual configuration value, and above is setting it to a function that returns a configuration.

I have added the ability to configure it like this in 6d00e0f544ddd7849a9104414c5d76cc15adb8a2.

You can now configure it like that as follows:

# nixosConfigurations/system.nix
{inputs, ...}:
inputs.nixpkgs.lib.nixosSystem {
  system = "x86_64-linux";
  modules = [];
}

If you do a nix flake lock --update-input flakelight and try again, it should evaluate. You'll likely have to use inputs.nixpkgs.lib unless your flake has a lib input.

Let me know if this fixes your issue.

noverby commented 1 year ago

Yes, that solves the problem! Thanks!