diff options
author | Svein Ove Aas <svein@google.com> | 2018-11-28 11:39:51 +0000 |
---|---|---|
committer | markuskowa <markus.kowalewski@gmail.com> | 2018-11-28 12:39:51 +0100 |
commit | 24865963f0e7886e1a42d8aa112306d7cc6cfbd8 (patch) | |
tree | 4b0752115950128309d738c65923545795f8b712 | |
parent | f2c07cd63ee4d40f5abb75c8336a1b9687a11222 (diff) | |
download | nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.tar nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.tar.gz nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.tar.bz2 nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.tar.lz nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.tar.xz nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.tar.zst nixlib-24865963f0e7886e1a42d8aa112306d7cc6cfbd8.zip |
modularity: Document the ability to use non-files in imports (#50503)
* modularity: Document the ability to use non-files in imports * Update nixos/doc/manual/configuration/modularity.xml Co-Authored-By: Baughn <svein@google.com>
-rw-r--r-- | nixos/doc/manual/configuration/modularity.xml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/doc/manual/configuration/modularity.xml b/nixos/doc/manual/configuration/modularity.xml index 298ffd661f67..cda36eba25c1 100644 --- a/nixos/doc/manual/configuration/modularity.xml +++ b/nixos/doc/manual/configuration/modularity.xml @@ -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. The example + 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> |