+5
-1
nixos/README-modular-services.md
+5
-1
nixos/README-modular-services.md
······
+3
-1
nixos/doc/manual/development/modular-services.md
+3
-1
nixos/doc/manual/development/modular-services.md
···-Refer to the contributor documentation in [`nixos/README-modular-services.md`](https://github.com/NixOS/nixpkgs/blob/master/nixos/README-modular-services.md).+For more details, refer to the contributor documentation in [`nixos/README-modular-services.md`](https://github.com/NixOS/nixpkgs/blob/master/nixos/README-modular-services.md).
+90
nixos/modules/system/service/README.md
+90
nixos/modules/system/service/README.md
···- **Simple attribute structure**: Unlike `environment.etc`, `configData` uses a simpler structure with just `enable`, `name`, `text`, `source`, and `path` attributes. Complex ownership options were omitted for simplicity and portability.+The modular service infrastructure avoids exposing `pkgs` as a module argument to service modules. Instead, derivations and builder functions are provided through lexical closure, making dependency relationships explicit and avoiding uncertainty about where dependencies come from.+- **Explicit dependencies**: Services declare what they need rather than implicitly depending on `pkgs`+- **No interference**: Service modules can be reused in different contexts without assuming a specific `pkgs` instance. An unexpected `pkgs` version is not a failure mode anymore.+- **Clarity**: With fewer ways to do things, there's no ambiguity about where dependencies come from (from the module, not the OS or service manager)+- **Portable layer**: Service modules in `portable/` do not receive `pkgs` as a module argument. Any required derivations must be provided by the caller.+- **Systemd integration**: The `systemd/system.nix` module imports `config-data.nix` as a function, providing `pkgs` in lexical closure:+1. Should explicitly declare their package dependencies as options rather than using `pkgs` defaults:+2. `passthru.services` can still provide a complete module using the package's lexical scope, making the module truly self-contained:
+4
-1
nixos/modules/system/service/portable/config-data.nix
+4
-1
nixos/modules/system/service/portable/config-data.nix
···
-1
nixos/modules/system/service/portable/service.nix
-1
nixos/modules/system/service/portable/service.nix
+4
-7
nixos/modules/system/service/systemd/system.nix
+4
-7
nixos/modules/system/service/systemd/system.nix
······
+3
-17
nixos/tests/modular-service-etc/python-http-server.nix
+3
-17
nixos/tests/modular-service-etc/python-http-server.nix
·········+enable = lib.mkDefault (config.python-http-server.directory == config.configData."webroot".path);
+28
-2
nixos/tests/modular-service-etc/test.nix
+28
-2
nixos/tests/modular-service-etc/test.nix
···
+2
nixos/tests/php/fpm-modular.nix
+2
nixos/tests/php/fpm-modular.nix
+7
-1
pkgs/by-name/gh/ghostunnel/package.nix
+7
-1
pkgs/by-name/gh/ghostunnel/package.nix
······
+7
-3
pkgs/by-name/gh/ghostunnel/service.nix
+7
-3
pkgs/by-name/gh/ghostunnel/service.nix
·········
+7
-1
pkgs/development/interpreters/php/generic.nix
+7
-1
pkgs/development/interpreters/php/generic.nix
······
+14
-6
pkgs/development/interpreters/php/service.nix
+14
-6
pkgs/development/interpreters/php/service.nix
············