NixOS/nixpkgs — pull request #1982 by wkennington (2014-03-19 00:03:30+00:00)
Title: substitute: Preserve newlines at the end of file

Newer version of udev require that files contain newlines at the end.
Many of the udev rules use substitute to replace hardcoded binary paths
with nix compatible binaries. Unfortunately, this breaks on the new
version of udev since substitute always strips the newline from the end
of a file it modifies.

This patch fixes the above behavior of substitute, by determining if the
original file had a newline at the end, and appends it to the modified
file.