Is it safe to cross flash partitions across devices? I've got my Nexus 5 replaced today. I was wondering if I could make a backup from the recovery on device A and flash this on device B? They are exactly the same, just a different physical device.
As long as it's the exact same model (be very careful here, since Nexus 5 has GSM and CDMA models) your plan will work.

If you are planning to unlock your phone's bootloader, root it and install a custom recovery and ROM, it's easily done with nandroid.


On original Nexus 5 you run nandroid backup.
Using adb pull copy the newly created backup directory to your PC (the path will be different depending on the recovery you are using.)
Unlock the bootloader of your new Nexus 5.
Boot into your new phone and enable USB Debugging.  Now hook it up via USB and accept the authorization prompt. This is a very important step.  Do not skip this, otherwise adb will refuse to connect to the phone, even in recovery.
Install same version of custom recovery as you were using on your original Nexus 5.
Using adb push copy the backup folder you retrieved in step 2 from your PC onto the new phone.
On the new phone boot into recovery and run nandroid restore.


Keep in mind that nandroid does not back up or restore the contents of media storage (/sdcard), so you will need to copy those files manually (adb pull/push works quite well, or you can use other methods as Izzy mentioned in the comments).

If you cannot (or don't want to) unlock the bootloader, you may want to look into using adb backup tool.  However, this method also has its down sides (e.g. SMS messages are not backed up or restored, failure to back up some media, etc.)