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