Merge pull request #264811 from emilylange/systemd-empty-unit-build

nixos/systemd-lib: fix building of empty unit files
This commit is contained in:
Will Fancher 2023-11-02 01:26:35 -04:00 committed by GitHub
commit 9fe9de9762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,10 @@ in rec {
pkgs.runCommand "unit-${mkPathSafeName name}"
{ preferLocalBuild = true;
allowSubstitutes = false;
inherit (unit) text;
# 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" ];
}
''