diff --git a/nixos/lib/systemd-lib.nix b/nixos/lib/systemd-lib.nix index 5c974f41dda5..99cc42c48a1d 100644 --- a/nixos/lib/systemd-lib.nix +++ b/nixos/lib/systemd-lib.nix @@ -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"