2021-02-14 02:38:20 +00:00
|
|
|
# External Art
|
|
|
|
When you need to use a module, overlay, or pass a value from one of your inputs
|
2021-04-27 01:29:05 +00:00
|
|
|
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.
|
2021-02-14 02:38:20 +00:00
|
|
|
|
2021-04-27 01:29:05 +00:00
|
|
|
## Overlays
|
|
|
|
External overlays can directly be added to a channel's `overlays` list.
|
2021-02-14 02:38:20 +00:00
|
|
|
|
2021-02-21 21:44:57 +00:00
|
|
|
flake.nix:
|
|
|
|
```nix
|
|
|
|
{
|
2021-04-27 01:29:05 +00:00
|
|
|
channels.nixos.overlays = [ inputs.agenix.overlay ];
|
2021-02-21 21:44:57 +00:00
|
|
|
}
|
|
|
|
```
|
2021-05-10 19:17:41 +00:00
|
|
|
Upon exporting overlays, these overlays will be automatically filtered out by inspecting the `inputs` argument.
|
2021-02-21 21:44:57 +00:00
|
|
|
|
2021-04-27 01:29:05 +00:00
|
|
|
## Modules
|
|
|
|
There is a dedicated `nixos.hostDefaults.externalModules` argument for external
|
|
|
|
modules.
|
|
|
|
|
|
|
|
flake.nix:
|
2021-02-20 19:42:36 +00:00
|
|
|
```nix
|
|
|
|
{
|
2021-04-27 01:29:05 +00:00
|
|
|
nixos.hostDefaults.externalModules = [ inputs.agenix.nixosModules.age ];
|
2021-02-21 21:44:57 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-04-27 01:29:05 +00:00
|
|
|
## 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:
|
2021-02-21 21:44:57 +00:00
|
|
|
```nix
|
|
|
|
{
|
2021-04-27 01:29:05 +00:00
|
|
|
home.externalModules = [ doom-emacs = doom-emacs.hmModule ];
|
2021-02-20 19:42:36 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2021-04-27 01:29:05 +00:00
|
|
|
> ##### Note:
|
|
|
|
> 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.
|