NixOS modules: Difference between revisions

Dafitt (talk | contribs)
m Changed example type
Dafitt (talk | contribs)
Added a short meta.doc description to the example
 
Line 276: Line 276:
To see how modules are setup and reuse other modules in practice put <code>hello.nix</code> in the same folder as your <code>configuration.nix</code>:
To see how modules are setup and reuse other modules in practice put <code>hello.nix</code> in the same folder as your <code>configuration.nix</code>:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">{ lib, pkgs, config, ... }:
{ lib, pkgs, config, ... }:
with lib;                       
with lib;                       
let
let
Line 285: Line 284:
   cfg = config.services.hello;
   cfg = config.services.hello;
in {
in {
  meta.doc = "Says hello every time you login.";
   # Declare what settings a user of this "hello.nix" module CAN SET.
   # Declare what settings a user of this "hello.nix" module CAN SET.
   options.services.hello = {
   options.services.hello = {
Line 303: Line 304:
     };
     };
   };
   };
}
}</syntaxhighlight>
</syntaxhighlight>


The other <code>configuration.nix</code> module can then import this <code>hello.nix</code> module  
The other <code>configuration.nix</code> module can then import this <code>hello.nix</code> module