From 1cc97befd5550732fd155d04cdd9eca3f5024dbc Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Wed, 8 Nov 2017 21:55:40 -0800 Subject: [PATCH] lib/eval-config: document NIXOS_EXTRA_MODULE_PATH This adds some documentation about importing modules external to Nixpkgs, which provides context for documenting NIXOS_EXTRA_MODULE_PATH. Closes #30376 --- .../manual/development/importing-modules.xml | 59 +++++++++++++++++++ .../manual/development/writing-modules.xml | 1 + 2 files changed, 60 insertions(+) create mode 100644 nixos/doc/manual/development/importing-modules.xml diff --git a/nixos/doc/manual/development/importing-modules.xml b/nixos/doc/manual/development/importing-modules.xml new file mode 100644 index 00000000000..ec1da09b950 --- /dev/null +++ b/nixos/doc/manual/development/importing-modules.xml @@ -0,0 +1,59 @@ +
+ +Importing Modules + + + Sometimes NixOS modules need to be used in configuration but exist + outside of Nixpkgs. These modules can be imported: + + + +{ config, lib, pkgs, ... }: + +{ + imports = + [ # Use a locally-available module definition in + # ./example-module/default.nix + ./example-module + ]; + + services.exampleModule.enable = true; +} + + + + The environment variable NIXOS_EXTRA_MODULE_PATH is + an absolute path to a NixOS module that is included alongside the + Nixpkgs NixOS modules. Like any NixOS module, this module can import + additional modules: + + + +# ./module-list/default.nix +[ + ./example-module1 + ./example-module2 +] + + + +# ./extra-module/default.nix +{ imports = import ./module-list.nix; } + + + +# NIXOS_EXTRA_MODULE_PATH=/absolute/path/to/extra-module +{ config, lib, pkgs, ... }: + +{ + # No `imports` needed + + services.exampleModule1.enable = true; +} + + +
diff --git a/nixos/doc/manual/development/writing-modules.xml b/nixos/doc/manual/development/writing-modules.xml index cb363b45675..a49f99cb266 100644 --- a/nixos/doc/manual/development/writing-modules.xml +++ b/nixos/doc/manual/development/writing-modules.xml @@ -180,6 +180,7 @@ in { +