Green’s Dictionary of Slang

squint like a bag of nails v.

[the squinter’s eyes point in as many directions as nails dropped into a bag]

to squint in a noticeable manner.

[UK]Grose Classical Dict. of the Vulgar Tongue (2nd, 3rd edn) n.p.: Bag of Nails. He squints like a bag of nails; i.e. his eyes are directed as many ways as the points of a bag of nails.
[UK]Lex. Balatronicum.
[US]R. Waln Hermit in America on Visit to Phila. 2nd series 27: ‘He squints like a bag of nails,’ said a fourth.
[US] ‘Scene in a London Flash-Panny’ Matsell Vocabulum 99: ‘I may bid as high as your pintle, and make you squint like a bag of nails,’ replied the intruder.
[US]Boston Globe (MA) 26 May [as Grose].