nixos/lib/systemd: migrate single-section attrsToSection to settingsToSections

This commit is contained in:
Grimmauld
2025-08-27 12:38:10 +02:00
parent e88c68514d
commit a27a433370

View File

@@ -732,10 +732,7 @@ rec {
commonUnitText = commonUnitText =
def: lines: def: lines:
'' (settingsToSections { Unit = def.unitConfig; })
[Unit]
${attrsToSection def.unitConfig}
''
+ lines + lines
+ optionalString (def.wantedBy != [ ]) '' + optionalString (def.wantedBy != [ ]) ''
@@ -753,10 +750,7 @@ rec {
enable enable
overrideStrategy overrideStrategy
; ;
text = '' text = (settingsToSections { Unit = def.unitConfig; });
[Unit]
${attrsToSection def.unitConfig}
'';
}; };
serviceToUnit = def: { serviceToUnit = def: {
@@ -840,10 +834,9 @@ rec {
enable enable
overrideStrategy overrideStrategy
; ;
text = commonUnitText def '' text = commonUnitText def (settingsToSections {
[Timer] Timer = def.timerConfig;
${attrsToSection def.timerConfig} });
'';
}; };
pathToUnit = def: { pathToUnit = def: {
@@ -856,10 +849,9 @@ rec {
enable enable
overrideStrategy overrideStrategy
; ;
text = commonUnitText def '' text = commonUnitText def (settingsToSections {
[Path] Path = def.pathConfig;
${attrsToSection def.pathConfig} });
'';
}; };
mountToUnit = def: { mountToUnit = def: {
@@ -872,10 +864,9 @@ rec {
enable enable
overrideStrategy overrideStrategy
; ;
text = commonUnitText def '' text = commonUnitText def (settingsToSections {
[Mount] Mount = def.mountConfig;
${attrsToSection def.mountConfig} });
'';
}; };
automountToUnit = def: { automountToUnit = def: {
@@ -888,10 +879,9 @@ rec {
enable enable
overrideStrategy overrideStrategy
; ;
text = commonUnitText def '' text = commonUnitText def (settingsToSections {
[Automount] Automount = def.automountConfig;
${attrsToSection def.automountConfig} });
'';
}; };
sliceToUnit = def: { sliceToUnit = def: {
@@ -904,10 +894,9 @@ rec {
enable enable
overrideStrategy overrideStrategy
; ;
text = commonUnitText def '' text = commonUnitText def (settingsToSections {
[Slice] Slice = def.sliceConfig;
${attrsToSection def.sliceConfig} });
'';
}; };
# Create a directory that contains systemd definition files from an attrset # Create a directory that contains systemd definition files from an attrset