at master 979 B view raw
1# Tests in: ../../tests/modular-service-etc/test.nix 2# This module sets the path for configData entries in systemd services 3let 4 setPathsModule = 5 prefix: 6 { lib, name, ... }: 7 let 8 inherit (lib) mkOption types; 9 servicePrefix = "${prefix}${name}"; 10 in 11 { 12 _class = "service"; 13 options = { 14 # Extend portable configData option 15 configData = mkOption { 16 type = types.lazyAttrsOf ( 17 types.submodule ( 18 { config, ... }: 19 { 20 config = { 21 path = lib.mkDefault "/etc/system-services/${servicePrefix}/${config.name}"; 22 }; 23 } 24 ) 25 ); 26 }; 27 services = mkOption { 28 type = types.attrsOf ( 29 types.submoduleWith { 30 modules = [ 31 (setPathsModule "${servicePrefix}-") 32 ]; 33 } 34 ); 35 }; 36 }; 37 }; 38in 39setPathsModule ""