nixos/systemd-lib: use structuredAttrs instead of passAsFile for makeUnit (#498934)
This commit is contained in:
@@ -78,16 +78,13 @@ rec {
|
||||
{
|
||||
preferLocalBuild = true;
|
||||
allowSubstitutes = false;
|
||||
# unit.text can be null. But variables that are null listed in
|
||||
# passAsFile are ignored by nix, resulting in no file being created,
|
||||
# making the mv operation fail.
|
||||
text = optionalString (unit.text != null) unit.text;
|
||||
passAsFile = [ "text" ];
|
||||
text = unit.text or "";
|
||||
__structuredAttrs = true;
|
||||
}
|
||||
''
|
||||
name=${shellEscape name}
|
||||
mkdir -p "$out/$(dirname -- "$name")"
|
||||
mv "$textPath" "$out/$name"
|
||||
printf "%s" "$text" > "$out/$name"
|
||||
''
|
||||
else
|
||||
pkgs.runCommand "unit-${mkPathSafeName name}-disabled"
|
||||
|
||||
Reference in New Issue
Block a user