Jump to content

Modular Services: Difference between revisions

From Official NixOS Wiki
Ehmry (talk | contribs)
not appropriate
Added some information to wiki
Line 1: Line 1:
{{warning | Work in progress }}


Modular Services are a new experimental module system support in Nixpkgs, that aims to expand the module systems (Eg. NixOS, home-manager, nix-darwin, etc) ecosystem with modularity and portability. Modular services is designed to integrate/compose with other modules systems such as NixOS.
== Difference between Traditional Module Systems (such as NixOS) vs Modular Services ==
Modular services are built for composability, re-usability, are not defined in sets of options, portable.
Where as traditional modules are the opposite.
== How to use ==
* System:
<syntaxhighlight lang="nix">
  system.services.<name> = {
    # Usage inside of the traditional module system like NixOS...
    imports = [ pkgs.example.services.default ];
    example.allowAll = false;
  };
</syntaxhighlight>
* User:
{{warning | Not all module systems support this, like for example NixOS.}}
<syntaxhighlight lang="nix">
  system.user.services.<name> = {
    # Usage inside of the traditional module system like NixOS...
    imports = [ pkgs.example.services.default ];
    example.allowAll = false;
  };
</syntaxhighlight>
== References ==
<references />

Revision as of 01:46, 14 July 2026

⚠︎
Warning: Work in progress

Modular Services are a new experimental module system support in Nixpkgs, that aims to expand the module systems (Eg. NixOS, home-manager, nix-darwin, etc) ecosystem with modularity and portability. Modular services is designed to integrate/compose with other modules systems such as NixOS.

Difference between Traditional Module Systems (such as NixOS) vs Modular Services

Modular services are built for composability, re-usability, are not defined in sets of options, portable. Where as traditional modules are the opposite.

How to use

  • System:
  system.services.<name> = {
    # Usage inside of the traditional module system like NixOS...
    imports = [ pkgs.example.services.default ];
    example.allowAll = false;
  };
  • User:
⚠︎
Warning: Not all module systems support this, like for example NixOS.
  system.user.services.<name> = {
    # Usage inside of the traditional module system like NixOS...
    imports = [ pkgs.example.services.default ];
    example.allowAll = false;
  };


References