Custom ROM

If your phone is not supported anymore (Nexus 5) you can install a custom rom to have all security related updates on it.

It first the phone must have an unlocked boot loader .

Install TWRP

Download twrp from: https://twrp.me/devices/lgnexus5.html

I used https://dl.twrp.me/hammerhead/twrp-3.0.2-0-hammerhead.img

Make sure developer mode is enabled on the phone.
Rename twrp-3.0.2-0-hammerhead.img -> recovery.img Open a terminal and type:

adb reboot bootloader
fastboot flash recovery d:\Nexus5_backup\recovery.img
fastboot reboot

Make sure to hold directly volumn down + power.

Now select recovery mode and you should see the new recovery image loaded.

Backup

Connect a OTG usb adapter and a USB stick (formatted with FAT32). In TWRP select backup and select OTG as backup destination.

Install custom rom

I use the pure nexus project: http://forum.xda-developers.com/google-nexus-5/development/rom-pure-nexus-substratum-t3477787

Tested with: