1 # Importing Modules {#sec-importing-modules}
3 Sometimes NixOS modules need to be used in configuration but exist
4 outside of Nixpkgs. These modules can be imported:
7 { config, lib, pkgs, ... }:
11 [ # Use a locally-available module definition in
12 # ./example-module/default.nix
16 services.exampleModule.enable = true;
20 The environment variable `NIXOS_EXTRA_MODULE_PATH` is an absolute path
21 to a NixOS module that is included alongside the Nixpkgs NixOS modules.
22 Like any NixOS module, this module can import additional modules:
25 # ./module-list/default.nix
33 # ./extra-module/default.nix
34 { imports = import ./module-list.nix; }
38 # NIXOS_EXTRA_MODULE_PATH=/absolute/path/to/extra-module
39 { config, lib, pkgs, ... }:
44 services.exampleModule1.enable = true;