1
1
mirror of https://github.com/divnix/digga.git synced 2024-11-27 09:29:27 +03:00
digga/doc/concepts/extern.md
Pacman99 8f20bb069a
doc/extern: elaborate external modules filtering
Co-authored-by: David Arnold <dar@xoe.solutions>
2021-05-10 12:19:31 -07:00

1.3 KiB

External Art

When you need to use a module, overlay, or pass a value from one of your inputs to the rest of your NixOS configuration, you can make use of a couple arguments. It is encouraged to add external art directly in your flake.nix so the file represents a complete dependency overview of your flake.

Overlays

External overlays can directly be added to a channel's overlays list.

flake.nix:

{
  channels.nixos.overlays = [ inputs.agenix.overlay ];
}

Upon exporting overlays, these overlays will be automatically filtered out by inspecting the inputs argument.

Modules

There is a dedicated nixos.hostDefaults.externalModules argument for external modules.

flake.nix:

{
  nixos.hostDefaults.externalModules = [ inputs.agenix.nixosModules.age ];
}

Home Manager

Since there isn't a hosts concept for home-manager, externalModules is just a top-level argument in the home namespace.

flake.nix:

{
  home.externalModules = [ doom-emacs = doom-emacs.hmModule ];
}
Note:

To avoid declaring "external" modules separately, which is obvious since they come from inputs, the optimal solution would be to automatically export modules that were created in your flake. But this is not possible due to NixOS/nix#4740.