Skip to content

Commit

Permalink
modularity: Document the ability to use non-files in imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Baughn committed Nov 17, 2018
1 parent 93b6863 commit 2722911
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions nixos/doc/manual/configuration/modularity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,23 @@ nix-repl> map (x: x.hostName) config.<xref linkend="opt-services.httpd.virtualHo
[ "example.org" "example.gov" ]
</screen>
</para>

<para>
While abstracting your configuration, you may find it useful to generate
modules using code, instead of writing files. This is also an option; the
below would have the same effect as importing a file which sets those
options.
<screen>
{ config, pkgs, ... }:

let netConfig = { hostName }: {
networking.hostName = hostName;
networking.useDHCP = false;
};

in

{ imports = [ (netConfig "nixos.localdomain") ]; }
</screen>
</para>
</section>

0 comments on commit 2722911

Please sign in to comment.