Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules Structure: separate (nixos) config from options #33

Open
hsjobeki opened this issue Sep 16, 2024 · 2 comments
Open

Modules Structure: separate (nixos) config from options #33

hsjobeki opened this issue Sep 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@hsjobeki
Copy link
Contributor

When playing around with nixos-facter-modules i noticed that the files could be a bit optimized.

  • somebody may want to import only the interface (options) but also would need to import all the nixos modules, because it sets config options in the same files.
# broadcom.nix
{ lib, config, ... }:
let
  inherit (config.facter) report;
  cfg = config.facter.networking.broadcom;
in
{
  options.facter.networking.broadcom = with lib; {
   # ...
  };

  config = {
    hardware.enableRedistributableFirmware = lib.mkIf cfg.full_mac.enable (lib.mkDefault true);

    boot = lib.mkIf cfg.sta.enable {
      kernelModules = [ "wl" ];
      extraModulePackages = [ config.boot.kernelPackages.broadcom_sta ];
    };
  };

}
@hsjobeki hsjobeki added the enhancement New feature or request label Sep 16, 2024
@brianmcgee
Copy link
Member

@hsjobeki is it generally better practice to define options separately from config?

@hsjobeki
Copy link
Contributor Author

@hsjobeki is it generally better practice to define options separately from config?

Yes. I'd say so. But i havent seen any general recommendation ruleset. But that should be on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants