at master 1.6 kB view raw
1# Tests in: ../../../../tests/modular-service-etc/test.nix 2 3# Non-modular context provided by the modular services integration. 4{ pkgs }: 5 6# Configuration data support for portable services 7# This module provides configData for services, enabling configuration reloading 8# without terminating and restarting the service process. 9{ 10 lib, 11 ... 12}: 13let 14 inherit (lib) mkOption types; 15 inherit (lib.modules) importApply; 16in 17{ 18 options = { 19 configData = mkOption { 20 default = { }; 21 example = lib.literalExpression '' 22 { 23 "server.conf" = { 24 text = ''' 25 port = 8080 26 workers = 4 27 '''; 28 }; 29 "ssl/cert.pem" = { 30 source = ./cert.pem; 31 }; 32 } 33 ''; 34 description = '' 35 Configuration data files for the service 36 37 These files are made available to the service and can be updated without restarting the service process, enabling configuration reloading. 38 The service manager implementation determines how these files are exposed to the service (e.g., via a specific directory path). 39 This path is available in the `path` sub-option for each `configData.<name>` entry. 40 41 This is particularly useful for services that support configuration reloading via signals (e.g., SIGHUP) or which pick up changes automatically, so that no downtime is required in order to reload the service. 42 ''; 43 44 type = types.lazyAttrsOf (types.submodule (importApply ./config-data-item.nix pkgs)); 45 }; 46 }; 47}